I have a geoJSON file I'm trying to render using d3 but am having difficulty targeting the correct features for projection.
Currently I've been working quite a bit with the us.json file found in many of the d3 examples but the map I'm currently working on uses United States "Commuting Zones" (CZ's) instead of land, states, or counties.
I'm used to calling
topojson.feature(us, us.objects.states)
to display the correct layer however my file is not organized into objects and does not have multiple layers. Here is an excerpt from the geoJSON file I'm attempting to use:
{"type":"FeatureCollection","bbox":[-120.30602148510043,6.667736880597216,-70.95829310710806,34.46308750538215],"features":[{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-83.802805983004,22.64602264051764],[-83.8080569412408,22.638128812605782],
Here is my code that is unsuccessful at rendering:
d3.json("CZ90.zip.geojson", function(error, us) {
if (error) throw error;
d3.select("svg").append("path")
.datum(topojson.feature(us, us.CZ90))
.attr("d", d3.geo.path());
});
Since there are no objects I've omitted the ".object" and when I drop the file into Mapshaper it renders correctly with a layer titled "CZ90" which is how I got to writing "us.CZ90" instead of "us.objects.states"
I realize I'm calling "topojson.feature" instead of something geoJSON specific but I've also been unable to successfully convert the file to topoJSON in Mapshaper without losing the projection type/info.
What is the correct way to target this layer in the .datum call?
This whole issue would also be solved if I could locate a topoJSON file like the us.json that includes a commuting zones layer!