maps.chandlerswift.com/layers/mn-sales-tax/index.js

45 lines
965 B
JavaScript

import GeoJSON from 'ol/format/GeoJSON.js';
import VectorLayer from 'ol/layer/Vector.js';
import VectorSource from 'ol/source/Vector.js';
import history from './data/history.js';
import { Fill, Stroke, Style, Text } from 'ol/style.js';
function style(feature){
return new Style({
text: new Text({
text: feature.get('NameLabel') + ': ' + feature.get('TotalFrmal'),
}),
fill: new Fill({
color: 'rgba(255,255,255,0.4)',
}),
stroke: new Stroke({
color: '#008800',
width: 1.25,
}),
});
}
const layers = {
name: "Minnesota Sales Tax",
layers: [],
};
for (let [name, url] of Object.entries(history)) {
const layer = new VectorLayer({
source: new VectorSource({
url,
format: new GeoJSON,
}),
style: style,
});
layers.layers.push({
name,
layer,
});
}
export default layers;