Add MN Adventure Trails
This commit is contained in:
parent
5ade88be5e
commit
142f8bbe6a
4 changed files with 72 additions and 0 deletions
40
layers/minnesota-adventure-trails/index.js
Normal file
40
layers/minnesota-adventure-trails/index.js
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import VectorLayer from 'ol/layer/Vector';
|
||||
import {Vector as VectorSource} from 'ol/source.js';
|
||||
import GeoJSON from 'ol/format/GeoJSON.js';
|
||||
|
||||
import {Style, Stroke} from 'ol/style.js';
|
||||
|
||||
import data from './routes.js';
|
||||
|
||||
const trails = {
|
||||
name: "Minnesota Adventure Trails",
|
||||
details: `<a href="https://minnesotaadventuretrails.com/">https://minnesotaadventuretrails.com/</a>`,
|
||||
layers: [],
|
||||
};
|
||||
|
||||
for (let [chain, url] of Object.entries(data)) {
|
||||
const colors = '0,0,0';
|
||||
const vectorLayer = new VectorLayer({
|
||||
source: new VectorSource({
|
||||
url: url,
|
||||
format: new GeoJSON,
|
||||
}),
|
||||
style: function(feature, resolution){
|
||||
return new Style({
|
||||
stroke: new Stroke({
|
||||
color: `rgba(${colors},${Math.min(1, Math.pow(resolution/10, 1/4))})`,
|
||||
width: 10/Math.pow(resolution, 1/4),
|
||||
})
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
trails.layers.push({
|
||||
name: chain,
|
||||
layer: vectorLayer,
|
||||
});
|
||||
}
|
||||
|
||||
trails.layers.sort((a, b) => a.name > b.name ? 1 : -1); // Names are always unique
|
||||
|
||||
export default trails;
|
||||
Loading…
Add table
Add a link
Reference in a new issue