These scripts convert source geospatial files into boundary vector tiles.
yarn install- GDAL 2.4.0 or later (GDAL 3 untested, but may work)
- Optional. Used for converting shapefile to GeoJSON in
toGeoJSONstep
- Optional. Used for converting shapefile to GeoJSON in
- Tippecanoe version 1.32.10 or later
- Required for creating vector tiles in
makeVectorTilesstep
- Required for creating vector tiles in
- NodeJS (v14 working)
Each boundary type has a specific identifier (eg, DEMO_TRIANGLES).
- Add configuration options for the boundary type to
config.json5 - Place source files in
srcdata(matching boundary type name inconfig.json5)
Optional ENVs
- Override the configuration file to be read with environment variable:
export BOUNDARYTYPESCONFIG="./config-terria.json5" - Limit the boundary type(s) with comma-separated types in environment variable:
export BOUNDARYTYPES=DEMO_TRIANGLES
If using shapeNames/shapefiles in config.json5
gulp toGeoJSON: unzips source files and converts to newline-delimited GeoJSON
Convert GeoJSON to ndjson
yarn run geojson2ndjson $INPUT_GEOJSON_PATH > ./geojson/$BOUNDARY_TYPE.nd.json- set
$BOUNDARY_TYPE- for example `DEMO_TRIANGLES``
- set
Run gulp <task>:
addFeatureIds: adds a FID field to each GeoJSON feature, writes to a new file.makeRegionIds: generates a regionids file for each region prop.makeVectorTiles: generatesmbtiles/$BOUNDARY_TYPE/{z}/{x}/{y}.pbffrom the FID-enriched GeoJSON file.updateRegionMapping: adds or updates an entry inregionMapping/regionMapping.json.all: does all of the above (includingtoGeoJSON)
WARNING this will serve the entire boundary-tiles directory on port 3000.
This assumes you have TerriaMap running on port 3001
Run gulp previewInTerria and click on link in console
- Splice into
wwwroot/data/regionMapping.jsonpart of the generatedregionMapping/regionMapping.json - Update other entries in
wwwroot/data/regionMapping.jsonif the default year for a region type has now changed. - Copy into
wwwroot/data/regionids/the generated files inregionMapping/regionids/
Configuration should be added to config-terria.json5 and committed to the repo to preseve the options used.
aws --profile terria s3 cp ./mbtiles/$BOUNDARY_TYPE s3://tiles.terria.io/$BOUNDARY_TYPE --recursive- You can run the above command with
--dryrunflag to see uploaded paths
You may want to increase number of concurrent requests
aws configure set s3.max_concurrent_requests 50 --profile terria