topojson / topojson-server

Convert GeoJSON to TopoJSON.
ISC License
117 stars 32 forks source link

should linestrings which fold back on themselves be cut? #13

Open andrewharvey opened 6 years ago

andrewharvey commented 6 years ago

In this sample GeoJSON a LineString goes from A to B to C to B to A.

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "LineString",
        "coordinates": [[0, 0], [1, 0], [2, 0], [1, 0], [0, 0]]
      }
    }
  ]
}

I was expecting that encoded as TopoJSON the arc A to B to C would be saved as the arc A-B-C and the LineString saved as that arc + reverse of the arc, but instead it's just one arc.

{"type":"Topology","objects":{"abcba":{"type":"GeometryCollection","geometries":[{"type":"LineString","arcs":[0]}]}},"arcs":[[[0,0],[1,0],[2,0],[1,0],[0,0]]],"bbox":[0,0,2,0]}

Is this the intended output or is it a bug?

mbostock commented 6 years ago

Related topojson/topojson#121.