diff --git a/.gitignore b/.gitignore index 9b035f8..68107d3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ dist *.geojson *.shp layers/dot-cams/*/data/states.js +layers/survey-markers/states.js diff --git a/layers/index.js b/layers/index.js index bcf6fa9..025c744 100644 --- a/layers/index.js +++ b/layers/index.js @@ -17,6 +17,7 @@ import light_pollution from './light_pollution.js'; import state_land from './state-land/index.js'; import trips from './trips/index.js'; import dot_cams from './dot-cams/index.js'; +import survey_markers from './survey-markers/index.js'; const layerCategories = [ { // Base maps @@ -88,6 +89,7 @@ const layerCategories = [ }, ] }, + survey_markers, dot_cams, trips, chains, diff --git a/layers/survey-markers/get_data.sh b/layers/survey-markers/get_data.sh new file mode 100755 index 0000000..8d53888 --- /dev/null +++ b/layers/survey-markers/get_data.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +# TODO: use https://geodesy.noaa.gov/pub/DS_ARCHIVE/BETA_PRODUCTS/ instead +# I should have used this in the first place, but it took me a long time to find + +mkdir -p data + +mkdir -p tmp +cd tmp +for state in $(curl https://geodesy.noaa.gov/cgi-bin/sf_archive.prl | grep "> states.js +done +echo >> states.js +echo "export default {" >> states.js +for file in ./data/*; do + basename=$(basename $file .geojson) + echo " $basename: _$basename," >> states.js +done +echo "};" >> states.js diff --git a/layers/survey-markers/index.js b/layers/survey-markers/index.js new file mode 100644 index 0000000..c944d19 --- /dev/null +++ b/layers/survey-markers/index.js @@ -0,0 +1,39 @@ +import VectorLayer from 'ol/layer/Vector'; +import {Vector as VectorSource} from 'ol/source.js'; +import GeoJSON from 'ol/format/GeoJSON.js'; + +import {Style} from 'ol/style.js'; +import Icon from 'ol/style/Icon.js'; + +import pin from './pin.svg?url'; +import states from './states.js'; + +let survey_markers = { + name: "National Geodetic Survey Markers", + details: `These are extremely large, and loading too many at once may crash your browser.
Enable All (will definitely crash your browser)`, + layers: [], +}; + +for (let [state, url] of Object.entries(states)) { + const vectorLayer = new VectorLayer({ + source: new VectorSource({ + url: url, + format: new GeoJSON, + }), + style: new Style({ + image: new Icon({ + anchor: [0.5, 1], + src: pin, + }), + }), + }); + + survey_markers.layers.push({ + name: state, + layer: vectorLayer, + }); +} + +survey_markers.layers.sort((a, b) => a.name > b.name ? 1 : -1); // Names are always unique + +export default survey_markers; diff --git a/layers/survey-markers/pin.svg b/layers/survey-markers/pin.svg new file mode 100644 index 0000000..36dca6a --- /dev/null +++ b/layers/survey-markers/pin.svg @@ -0,0 +1,13 @@ + + + + +