I am attempting to make different maps of NYC using d3 v4. I was able to make one by Community District. However, when I attempt to make one by ZIP code, the result is a scrambled mess.(See here) I've double-checked my JavaScript, and I haven't noticed anything wrong.
Here is my javascript:
d3.queue()
.defer(d3.json,'./nyc_zip_code.json')
.await(ready)
function ready(error, data){
if(error) throw error
const nycMap = topojson.feature(data,{
type:'GeometryCollection',
geometries: data.objects.ZIP_CODE_040114.geometries
})
//projection
const projection = d3.geoAlbersUsa()
.fitExtent([[20,20],[460,500]], nycMap)
//geopath
const geoPath = d3.geoPath()
.projection(projection)
d3.select('svg.nyc-map-zip-code').selectAll('path')
.data(nycMap.features)
.enter()
.append('path')
.attr('d', geoPath)
}
And here is the link to TopoJSON file I converted using MapShaper. My source for the original SHP file is here.
Any clues to what I am doing wrong would be wonderful.