maps.chandlerswift.com/layers/chains/krispy-kreme/layer.js

25 lines
612 B
JavaScript
Raw Permalink Normal View History

2023-07-24 22:52:40 -05:00
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 url from './data.geojson?url'; // TODO: remove `?url`?
import pin from './pin.svg?url'; // TODO: remove `?url`?
2023-07-24 22:52:40 -05:00
const vectorLayer = new VectorLayer({
source: new VectorSource({
url: url,
2023-07-24 22:52:40 -05:00
format: new GeoJSON,
}),
style: new Style({
image: new Icon({
anchor: [0.5, 1],
src: pin,
2023-07-24 22:52:40 -05:00
}),
}),
});
export default vectorLayer;