I am learning how to convert ESRI shapefiles to GeoJSON and then work with it in D3. I am following Mike Bostock's tutorial on Medium (https://medium.com/@mbostock/command-line-cartography-part-1-897aa8f8ca2c#.8jny46gjo) to help me as I go. The tutorial overestimates my ability a bit, however.
First I went to get a shapefile. I decided to use Australia. In this case I used the "Postal Areas" shapefile from http://www.abs.gov.au/AUSSTATS/abs@.nsf/DetailsPage/1270.0.55.003July%202011?OpenDocument
Then I opened it in QGIS to get a sense for what to expect. I noted that it uses EPSG:4283 and looked that up on Spatial Reference (http://spatialreference.org/ref/epsg/4283/html/). I tried, but failed, to use this to get some kind of understanding of what projection to use in D3 but decided to move forward anyway.
I dug around a little more and found an Australian Albers projection (http://spatialreference.org/ref/epsg/3577/html/) that looked a bit more like the California Albers that Bostock used in the tutorial and ran with that.
Next I moved on to converting my shapefile to GeoJSON. I deviated from the tutorial a bit here by using ogr2ogr because I had some trouble with shp2json. I ran the following command using the shapefile name provided in the zip file:
ogr2ogr -f GeoJSON -t_srs epsg:4283 POA_2011_AUST.geojson POA_2011_AUST.shp
Since I had the Australia Albers projection information from EPSG:3577, I used that in geoproject as follows:
geoproject 'd3.geoConicEqualArea().parallels([-18,-36]).rotate([-132,0]).fitSize([960,960],d)' < POA_2011_AUST.geojson > aus_postal-transmerc.json
I took the output, aus_postal-transmerc.json and dropped it into mapshaper.org to see what I had achieved. Its something, but not much - I basically have an upside down map of Australia.
I have spent hours but I cannot seem to hit on a lead that gives me an idea of what I am doing wrong. I thought perhaps the original shapefile might be a problem so I tried the same test for a shapefile of Japan. I used d3.geoTransverseMercator() in that case but ultimately ended up with the same problem - the result was an upside down map.
The only thing I have not tried yet is just throwing things at the wall to see what sticks - randomly using different projections until something just works. That seems wrong, though. I imagine that there must be recommended projections for each shapefile but I am completely stumped.
Am I missing something terribly obvious?