Given an input of atomic polygons with zone values, produce topojson hurricane zones for https://github.com/CityOfNewYork/hurricane.
- Export source ESRI file geodatabase to the dreaded shapeile
CALL c:\Progra~1\ArcGIS\Pro\bin\Python\scripts\propy.bat .\src\py\gdb2shp.py EvacZone_20210517.gdb EvacZone_20210517
- Tear down anything, set up and import dreaded shapefile into a PostGIS database
export PGUSER=scratchuser
export PGPASSWORD=PostGisIsMyDataBae!
export PGDATABASE=scratchdatabase
./src/importdreadedshapefile.sh
- Clean up atomic polygons
Run 2x to ensure no updates on second pass.
psql -f src/sql/cleanup.sql
- Aggregate atomic polygons on zones
psql -f src/sql/aggregate.sql
- Clean up fully contained small interior rings
psql -f src/sql/functionfilterrings.sql
psql -f src/sql/removesmallinteriorrings.sql
- Tweak Any Values and Types
psql -f src/sql/updatezones.sql
- Simplify
Visvalingham-Whyatt simplification should remove spikes at zone boundaries and some gaps. However some gaps and overlaps may remain, requiring additional edge matching work. After simplification we'll remove large remaining interior rings.
psql -f src/sql/simplify.sql
- Review and manual fix
Visually review zones_simplified. If this is intended to be a final-ish version manual cleanup of gaps and overlaps should happen here.
- Transform to WGS84 and any final output formatting
psql -f src/sql/transform.sql
- Export to geojson
C:\"Program Files"\"QGIS 3.16"\bin\ogr2ogr.exe -f GeoJSON hurricane_zones.geojson "PG:host=localhost dbname=scratchdatabase user=scratchuser password=PostGisIsMyDataBae!" -sql "select zone,geog from zones_out" -lco COORDINATE_PRECISION=6
output: hurricane_zones.geojson
- Convert to topojson
Mapshaper for now, ogr2ogr doesnt output topojson.
output: hurricane_zones.json