Add MN Adventure Trails
This commit is contained in:
parent
5ade88be5e
commit
142f8bbe6a
|
@ -19,6 +19,7 @@ import trips from './trips/index.js';
|
||||||
import dot_cams from './dot-cams/index.js';
|
import dot_cams from './dot-cams/index.js';
|
||||||
import survey_markers from './survey-markers/index.js';
|
import survey_markers from './survey-markers/index.js';
|
||||||
import tjx from './tjx/index.js';
|
import tjx from './tjx/index.js';
|
||||||
|
import minnesotaAdventureTrails from './minnesota-adventure-trails/index.js';
|
||||||
|
|
||||||
const layerCategories = [
|
const layerCategories = [
|
||||||
{ // Base maps
|
{ // Base maps
|
||||||
|
@ -90,6 +91,7 @@ const layerCategories = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
minnesotaAdventureTrails,
|
||||||
survey_markers,
|
survey_markers,
|
||||||
dot_cams,
|
dot_cams,
|
||||||
trips,
|
trips,
|
||||||
|
|
2
layers/minnesota-adventure-trails/.gitignore
vendored
Normal file
2
layers/minnesota-adventure-trails/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*.kmz
|
||||||
|
routes.js
|
28
layers/minnesota-adventure-trails/get_data.sh
Executable file
28
layers/minnesota-adventure-trails/get_data.sh
Executable file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# SEMAT: https://www.google.com/maps/d/u/0/viewer?mid=1fd5DwCNSTNyd2ijSa3FcKTXfn85wFD8
|
||||||
|
# NEMAT: https://www.google.com/maps/d/u/0/viewer?mid=19EWOYHcIlO9HX3Xwc6peFxMwdhsEt78
|
||||||
|
# NCMAT: https://www.google.com/maps/d/u/0/viewer?mid=1qtnoqH2w_E4QT8rDYStKw_S1TWI-cRw
|
||||||
|
|
||||||
|
cd $(dirname $0)
|
||||||
|
|
||||||
|
for file in *.kmz; do
|
||||||
|
zcat "$file" | ogr2ogr -f GeoJSON "$(basename "$file" .kmz).geojson" /vsistdin/ -skipfailures
|
||||||
|
done
|
||||||
|
|
||||||
|
# hack hack hack
|
||||||
|
truncate -s 0 routes.js
|
||||||
|
i=0
|
||||||
|
for file in ./*.geojson; do
|
||||||
|
echo "import _file$i from '$file?url';" >> routes.js
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
echo >> routes.js
|
||||||
|
echo "export default {" >> routes.js
|
||||||
|
i=0
|
||||||
|
for file in ./*.geojson; do
|
||||||
|
basename=$(basename "$file" .geojson)
|
||||||
|
echo " \"$basename\": _file$i," >> routes.js
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
echo "};" >> routes.js
|
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…
Reference in a new issue