问题
I have gdal 1.10.1 and topojson 1.4.0 installed on my MacOs 10.7.5. I have downloaded the ne_110m_ocean form Natural Earth.
I successfully transformed the shape file in GeoJSON:
ogr2ogr \
-f GeoJSON \
ocean.json \
ne_110m_ocean.shp
Then I transformed the GeoJSON into topojson:
topojson \
-o ocean_tj.json \
ocean=ocean.json \
When I plot using the GeoJSON file all works fine.
d3.json("ocean.json", function(json) {
svg.selectAll("path")
.data(json.features)
.enter()
.append("path")
.attr("d", path)
.style("fill", "steelblue");
});
When I plot using the topojson file, instead of having the polygons of the oceans I get the polygons of the lands!!!!
d3.json("ocean_tj.json", function(topology) {
var ocean = topojson.feature(topology, topology.objects.ocean);
svg.append("path")
.datum(ocean)
.attr("d", path)
.style("fill", "red");
});
Can anyone help?
Thanks in advance
回答1:
Using the option --no-force-clockwise
fix the issue:
topojson -o ocean_tj.json ocean=ocean.json --no-force-clockwise
来源:https://stackoverflow.com/questions/19023995/how-to-convert-ocean-shape-file-into-topojson