Question

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

Was it helpful?

Solution

Using the option --no-force-clockwise fix the issue:

topojson -o ocean_tj.json ocean=ocean.json --no-force-clockwise
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top