Compare commits

...

3 commits

6 changed files with 74 additions and 2 deletions

View file

@ -19,6 +19,7 @@ import trips from './trips/index.js';
import dot_cams from './dot-cams/index.js';
import survey_markers from './survey-markers/index.js';
import tjx from './tjx/index.js';
import minnesotaAdventureTrails from './minnesota-adventure-trails/index.js';
const layerCategories = [
{ // Base maps
@ -90,6 +91,7 @@ const layerCategories = [
},
]
},
minnesotaAdventureTrails,
survey_markers,
dot_cams,
trips,

View file

@ -0,0 +1,2 @@
*.kmz
routes.js

View 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

View 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;

View file

@ -16,7 +16,7 @@ const visitedStatesLists = {
'IL',
'IN',
'KS',
// 'KY',
'KY',
'LA',
'MA',
'MD',

View file

@ -4,7 +4,7 @@ export default () => {
// https://stackoverflow.com/a/71162041/3814663
const commitDate = childProcess.execSync('git log -1 --format=%cI').toString().trimEnd();
const commitHash = childProcess.execSync('git rev-parse HEAD').toString().trimEnd();
const fileDates = childProcess.execSync(`find . -iname '*.geojson' -not -path './dist/*' | xargs ls -lh`).toString().trimEnd();
const fileDates = childProcess.execSync(`find . -iname '*.geojson' -not -path './dist/*' -exec ls -lh {} +`).toString().trimEnd();
process.env.VITE_GIT_COMMIT_DATE = commitDate;
process.env.VITE_GIT_COMMIT_HASH = commitHash;
process.env.VITE_FILE_DATES = fileDates;