mapbox / vector-tile-spec

Mapbox Vector Tile specification
https://www.mapbox.com/vector-tiles/specification/
Other
891 stars 210 forks source link

1st ring is negative area #92

Open Savvkin opened 7 years ago

Savvkin commented 7 years ago

Hello. I'm trying to parse tile 20524.vector.pbf.zip (mapbox streets v6) and one of the polygon feature has the first ring with negative area.

Layer: id=2, name=building Feature: id=4 Geometry: 0x0009 0x153E 0x058C 0x001A 0x00C9 0x00BB 0x04BC 0x050F 0x017A 0x0000 0x000F Ring: (2719 710) (2618 616) (3224 -32) (3413 -32) Area: -126149

What does it mean? How should I handle that? Vector Tile Spec says that 1st ring of polygon (ExteriorRing) must have a positive area.

Savvkin commented 7 years ago

Seems like NetTopologySuite signed area code and Mapbox GL JS signed area code provide different result, but both declare that they are based on the Shoelace formula (as required by the Spec)

flippmoke commented 7 years ago

I think this might be related to https://github.com/mapbox/vector-tile-spec/issues/80

Savvkin commented 7 years ago

Could you explain the difference between NTS Signed Area implementation and Mapbox Signed Area implementation of the same algorythm? They both declare to be based on Shoelace formula, but returns completely different result.

Also, it might be good idea to include reference pseudocode/c++/c#/js implementation in the spec document.