seattleio / seattle-boundaries-data

geojson for various boundaries in Seattle
45 stars 52 forks source link

TopoJSON #19

Open JohnTigue opened 8 years ago

JohnTigue commented 8 years ago

@sethvincent I have been thinking about adding TopoJSON files in here. Arguably they can pretty trivially be derived from the GeoJSON. We could even add in an npm script or some Gulp code to bang them out. But then one could also look at the GeoJSON as being derived from shapefiles.

There is the argument that this whole repo is one of convenience so giving folks the TopoJSON pre-generated would be more convenient. Your thoughts?

(I ask now as I have recently gotten Census Block Group and Census Block shapefiles from the City and am planning on adding them this week.)

sethvincent commented 8 years ago

sure! that would be useful.

JohnTigue commented 8 years ago

OK, I'll "make it so."

Also, I think this is getting to the point where we have enough to address: #8

I will take this on as my current extra-energy project. I think I have commit privileges to the repo but I will do the work in my own fork and talk/PR with you first.

sethvincent commented 8 years ago

Cool! I also plan to create a better ui at http://boundaries.seattle.io

I think it would be awesome to have both:

sllvn commented 8 years ago

I've learned it's much easier to convert GeoJSON -> TopoJSON (using mbostock/topojson) than the reverse, so if it becomes a choice, I'd recommend storing GeoJSON primarily and then perhaps providing an adapter service in the API to serve shapefiles or TopoJSON. Downside is that GeoJSON is much less compact than TopoJSON.

JohnTigue commented 8 years ago

Amen on that:
http://tigue.com/by-time/2015/12/14/generating-topojson-debug/

I was thinking that we'd use Gulp as the build tool. The "real" source would be the GeoJSONs, and for ultraconvenience have a built/ folder with some sane version of generated TopoJSON available for folks who want such.

JohnTigue commented 8 years ago

I added a TopoJSON file for City Council Districts. That file was generated directly from the City's shapefile via the command:

topojson --spherical --out city-council-districts.topojson geo_export_bb6ddf4f-ad18-4c66-9789-b4dc933df7cc.shp

Turns out GitHub can render TopoJSON. Since GitHub can use the file name pattern *.topojson (or *.geojson or *.json) as a clue to detect possible TopoJSON which should be rendered, and since we already use *.geojson for the GeoJSON, I went with same file name, just different suffix i.e.the repo now has city-council-districts.geojson and city-council-districts.topojson