mapbox / mapbox-annotation-extension

Framework extensions that can be used with the Mapbox Maps SDK for iOS.
ISC License
11 stars 18 forks source link

MGLPolygonStyleAnnotation coordinates do not conform to the GeoJSON spec #70

Closed TimothySealy closed 4 years ago

TimothySealy commented 4 years ago

According to the GeoJSON spec the coordinates of a Polygon "MUST be an array of linear ring coordinate arrays". This translates to an array of arrays of points. According to the example you have to pass an array of points to the MGLPolygonStyleAnnotation. It seems to be missing an additional (outer) array.

Source: https://tools.ietf.org/html/rfc7946#section-3.1.6

skreborn commented 4 years ago

MGLPolygonStyleAnnotation seems to have a constructor (declaration, definition) that accepts interior polygons (holes) as a separate parameter. Perhaps that is what you're looking for?

(instancetype)initWithCoordinates:(const CLLocationCoordinate2D *)coordinates count:(NSUInteger)count interiorPolygons:(NSArray<MGLPolygonFeature *> *)interiorPolygons
TimothySealy commented 4 years ago

@skreborn Thanks for the clarification. I overlooked the interiorPolygons parameter.

skreborn commented 4 years ago

Happy to help. Should this issue be closed then?

TimothySealy commented 4 years ago

Closing this up with two remarks:

  1. I think it would be a good idea to clarify the usage of the interior polygons in the documentation.
  2. A constructor overload which only takes polygons (where the first polygon is the outer and the rest inner polygons) would be appreciated.