The first problem is the connection:
vis.append("g") .selectAll("path") .data(json.coordinates) .enter().append("path") .attr("d", path);
This would mean that you need one path element for each element of the json.coordinates array. Since your test data is polygons, this means one path element for the outer ring, and then maybe several other path elements for any inner holes, if your data has them. I expect you only need one path element for the entire polygon.
The second problem is that you are not passing valid GeoJSON to the d3.geo.path instance. Since the data in your data union is json.coordinates , you simply pass an array of coordinates directly to path when you need to pass a GeoJSON geometry object or function. (See the GeoJSON specification .)
Fortunately, both of these problems are easily fixed by eliminating data merging and rendering of the full polygon. To add only one path element, simply call selection.append :
vis.append("path") .datum(json) .attr("d", path);
Your projection will probably need to be adjusted (translated and scaled). You can find the project in the bounding box example .
source share