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

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;