25 lines
664 B
JavaScript
25 lines
664 B
JavaScript
|
import VectorLayer from 'ol/layer/Vector';
|
||
|
import {Vector as VectorSource} from 'ol/source.js';
|
||
|
import GeoJSON from 'ol/format/GeoJSON.js';
|
||
|
|
||
|
import {Style} from 'ol/style.js';
|
||
|
import Icon from 'ol/style/Icon.js';
|
||
|
|
||
|
import kwikTripURL from '/data/kwik-trip-data.geojson?url'; // TODO: remove `?url`?
|
||
|
import pinURL from '/layers/kwik-trip/pin.svg?url'; // TODO: remove `?url`?
|
||
|
|
||
|
const vectorLayer = new VectorLayer({
|
||
|
source: new VectorSource({
|
||
|
url: kwikTripURL,
|
||
|
format: new GeoJSON,
|
||
|
}),
|
||
|
style: new Style({
|
||
|
image: new Icon({
|
||
|
anchor: [0.5, 1],
|
||
|
src: pinURL,
|
||
|
}),
|
||
|
}),
|
||
|
});
|
||
|
|
||
|
export default vectorLayer;
|