Add state land layer

This commit is contained in:
Chandler Swift 2023-08-27 17:39:55 -05:00
parent 69d567d13c
commit 8017e4d88b
Signed by: chandlerswift
GPG key ID: A851D929D52FB93F
5 changed files with 101 additions and 3 deletions

View file

@ -12,6 +12,7 @@ import states from './states/index.js';
import national_land from './national-land/index.js';
import cellular from './cellular.js';
import light_pollution from './light_pollution.js';
import state_land from './state-land/index.js';
const layerCategories = [
{ // Base maps
@ -79,6 +80,7 @@ const layerCategories = [
census_bureau,
states,
national_land,
state_land,
cellular,
light_pollution,
];

8
layers/state-land/get_data.sh Executable file
View file

@ -0,0 +1,8 @@
#!/bin/sh
# https://gisdata.mn.gov/dataset/bdry-dnr-lrs-prk
curl --silent --remote-name https://resources.gisdata.mn.gov/pub/gdrs/data/pub/us_mn_state_dnr/bdry_dnr_lrs_prk/shp_bdry_dnr_lrs_prk.zip
unzip shp_bdry_dnr_lrs_prk.zip
ogr2ogr -f GeoJSON mn-state-parks.geojson dnr_stat_plan_areas_prk.shp
# sed -i '/^"crs":/d' mn-state-parks.geojson # TODO: handle this projection properly
rm -r dnr_* metadata shp_bdry_dnr_lrs_prk.zip

View file

@ -0,0 +1,48 @@
import GeoJSON from 'ol/format/GeoJSON.js';
import VectorLayer from 'ol/layer/Vector.js';
import VectorSource from 'ol/source/Vector.js';
import stateParks from './mn-state-parks.geojson?url';
import { Fill, Stroke, Style, Text } from 'ol/style.js';
// Projection stuff
import proj4 from 'proj4';
import {register} from 'ol/proj/proj4.js';
// https://epsg.io/26915.proj4js
proj4.defs("EPSG:26915","+proj=utm +zone=15 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs");
register(proj4);
function style(feature){
return new Style({
text: new Text({
text: feature.get('AREA_NAME') + ' ' + feature.get('AREA_TYPE'),
}),
fill: new Fill({
color: 'rgba(255,255,255,0.4)',
}),
stroke: new Stroke({
color: '#008800',
width: 1.25,
}),
});
}
const layers = {
name: "MN State Parks",
layers: [
{
name: "State Parks",
layer: new VectorLayer({
source: new VectorSource({
url: stateParks,
format: new GeoJSON(),
}),
style: style,
}),
},
],
};
export default layers;

43
package-lock.json generated
View file

@ -8,10 +8,11 @@
"name": "maps.chandlerswift.com",
"version": "0.0.0",
"dependencies": {
"ol": "latest"
"ol": "latest",
"proj4": "2.9.0"
},
"devDependencies": {
"vite": "^4.0.4"
"vite": "^4.3.9"
}
},
"node_modules/@esbuild/android-arm": {
@ -534,6 +535,11 @@
"resolved": "https://registry.npmjs.org/mapbox-to-css-font/-/mapbox-to-css-font-2.4.1.tgz",
"integrity": "sha512-QQ/iKiM43DM9+aujTL45Iz5o7gDeSFmy4LPl3HZmNcwCE++NxGazf+yFpY+wCb+YS23sDa1ghpo3zrNFOcHlow=="
},
"node_modules/mgrs": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/mgrs/-/mgrs-1.0.0.tgz",
"integrity": "sha512-awNbTOqCxK1DBGjalK3xqWIstBZgN6fxsMSiXLs9/spqWkF2pAhb2rrYCFSsr1/tT7PhcDGjZndG8SWYn0byYA=="
},
"node_modules/minimist": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
@ -638,6 +644,15 @@
"node": "^10 || ^12 || >=14"
}
},
"node_modules/proj4": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/proj4/-/proj4-2.9.0.tgz",
"integrity": "sha512-BoDXEzCVnRJVZoOKA0QHTFtYoE8lUxtX1jST38DJ8U+v1ixY70Kpwi0Llu6YqSWEH2xqu4XMEBNGcgeRIEywoA==",
"dependencies": {
"mgrs": "1.0.0",
"wkt-parser": "^1.3.1"
}
},
"node_modules/protocol-buffers-schema": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz",
@ -775,6 +790,11 @@
"resolved": "https://registry.npmjs.org/web-worker/-/web-worker-1.2.0.tgz",
"integrity": "sha512-PgF341avzqyx60neE9DD+XS26MMNMoUQRz9NOZwW32nPQrF6p77f1htcnjBSEV8BGMKZ16choqUG4hyI0Hx7mA=="
},
"node_modules/wkt-parser": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/wkt-parser/-/wkt-parser-1.3.3.tgz",
"integrity": "sha512-ZnV3yH8/k58ZPACOXeiHaMuXIiaTk1t0hSUVisbO0t4RjA5wPpUytcxeyiN2h+LZRrmuHIh/1UlrR9e7DHDvTw=="
},
"node_modules/xml-utils": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/xml-utils/-/xml-utils-1.2.0.tgz",
@ -1065,6 +1085,11 @@
"resolved": "https://registry.npmjs.org/mapbox-to-css-font/-/mapbox-to-css-font-2.4.1.tgz",
"integrity": "sha512-QQ/iKiM43DM9+aujTL45Iz5o7gDeSFmy4LPl3HZmNcwCE++NxGazf+yFpY+wCb+YS23sDa1ghpo3zrNFOcHlow=="
},
"mgrs": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/mgrs/-/mgrs-1.0.0.tgz",
"integrity": "sha512-awNbTOqCxK1DBGjalK3xqWIstBZgN6fxsMSiXLs9/spqWkF2pAhb2rrYCFSsr1/tT7PhcDGjZndG8SWYn0byYA=="
},
"minimist": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
@ -1133,6 +1158,15 @@
"source-map-js": "^1.0.2"
}
},
"proj4": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/proj4/-/proj4-2.9.0.tgz",
"integrity": "sha512-BoDXEzCVnRJVZoOKA0QHTFtYoE8lUxtX1jST38DJ8U+v1ixY70Kpwi0Llu6YqSWEH2xqu4XMEBNGcgeRIEywoA==",
"requires": {
"mgrs": "1.0.0",
"wkt-parser": "^1.3.1"
}
},
"protocol-buffers-schema": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz",
@ -1215,6 +1249,11 @@
"resolved": "https://registry.npmjs.org/web-worker/-/web-worker-1.2.0.tgz",
"integrity": "sha512-PgF341avzqyx60neE9DD+XS26MMNMoUQRz9NOZwW32nPQrF6p77f1htcnjBSEV8BGMKZ16choqUG4hyI0Hx7mA=="
},
"wkt-parser": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/wkt-parser/-/wkt-parser-1.3.3.tgz",
"integrity": "sha512-ZnV3yH8/k58ZPACOXeiHaMuXIiaTk1t0hSUVisbO0t4RjA5wPpUytcxeyiN2h+LZRrmuHIh/1UlrR9e7DHDvTw=="
},
"xml-utils": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/xml-utils/-/xml-utils-1.2.0.tgz",

View file

@ -10,6 +10,7 @@
"vite": "^4.3.9"
},
"dependencies": {
"ol": "latest"
"ol": "latest",
"proj4": "2.9.0"
}
}