2023-07-03 17:13:20 -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, Stroke, Circle, Fill} from 'ol/style.js';
|
|
|
|
|
2023-07-25 19:12:30 -05:00
|
|
|
import url from './data.geojson?url'; // TODO: remove `?url`?
|
2023-07-03 17:13:20 -05:00
|
|
|
|
|
|
|
import visitedArenas from './visited.js'
|
|
|
|
|
|
|
|
const vectorLayer = new VectorLayer({
|
|
|
|
source: new VectorSource({
|
2023-07-25 19:12:30 -05:00
|
|
|
url: url,
|
2023-07-03 17:13:20 -05:00
|
|
|
format: new GeoJSON,
|
|
|
|
}),
|
|
|
|
// TODO: use '✓' and '✗' (or maybe '✔' and '✘') (from https://en.wikipedia.org/wiki/List_of_Unicode_characters#Dingbats)
|
|
|
|
// TODO: popups with Arena information (name, photo, date visited, score from that day)
|
|
|
|
style: function(feature, resolution) {
|
|
|
|
const base_color = visitedArenas.some(a => a.name == feature.get('name')) ? '#008800' : '#FF0000';
|
|
|
|
return new Style({
|
|
|
|
image: new Circle({
|
|
|
|
radius: 50/Math.pow(resolution, 1/4),
|
|
|
|
fill: new Fill({color: base_color + '33'}),
|
|
|
|
stroke: new Stroke({color: base_color, width: 1}),
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default vectorLayer;
|