Skip to content

Which arcs indexes can be dropped? #17

@gerardparareda

Description

@gerardparareda

Hi,

I've been trying to make a TopoJSON parser with C# and I've read the specification at least 10-20 times now. There's these lines which I can't understand:

If more than one arc is referenced to construct a LineString or LinearRing, the first position of a subsequent arc must be equal to the last position of the previous arc. Then, when reconstructing the geometry, the first position of each arc except the first may be dropped; equivalently, the last position of each arc except the last may be dropped.

I've found this example which I found quite illustrative and simple:

{ "type": "Topology", "objects": { "collection": { "type": "GeometryCollection", "geometries": [ { "type": "Polygon", "properties": { "name": "Left_Polygon" }, "arcs": [ [ 0, 1 ] ] }, { "type": "Polygon", "properties": { "name": "Right_Polygon" }, "arcs": [ [ 2, -1 ] ] } ] } }, "arcs": [ [ [ 1, 2 ], [ 0, -2 ] ], [ [ 1, 0 ], [ -1, 0 ], [ 0, 2 ], [ 1, 0 ] ], [ [ 1, 2 ], [ 1, 0 ], [ 0, -2 ], [ -1, 0 ] ] ], "transform": { "scale": [ 1.1957244926770118e-8, 1.4241991634471996e-8 ], "translate": [ 1.9563164719471948, 41.72678319291929 ] }, "bbox": [ 1.9563164719471948, 41.72678319291929, 1.9564360324392176, 41.726925598593645 ] }

from here: https://en.wikipedia.org/wiki/GeoJSON#TopoJSON_Schema.

What I don't undestand is when a LinearRing has more than one arc, the first index except the first can be dropped. This means that for the Left_Polygon second arc first index [1,0] is dropped. Does the first index from the first arc of the second LinearRing (Right_Polygon) [1,2] get dropped too? Do the reversed indexes get dropped too? When the -1 arc from Right_Polygon starts [1,0] for example.

I also don't understand this line:

equivalently, the last position of each arc except the last may be dropped.

This means that the (n-1) index of every arch except the last one gets dropped? If so there's no possible way I can reconstruct the original 2 LineRings...

Sorry for asking so many questions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions