Platform: iOS 10.2
Mapbox SDK version: 3.4
Polyline visible on map
Polyline does not added to map
Could you perhaps post code that reproduces this issue? Modifying our our test shapes example to start/end on the same coordinate works as expected:

func creatMapboxLine() -> MGLPolyline {
var coordinates = self.coordinates
return MGLPolyline(coordinates: &coordinates, count: UInt(coordinates.count))
}
self.mapView.addOverlays(lines)
Basically this is what I do, (I need to spend some time to test with a hardcoded line so I can get a better code snippet but a bit pressed for time right now). But if the line has identical start/ends it will not show up, and will not even ask for their styling (strokeColorForShapeAnnotation or lineWidthForPolylineAnnotation)
If i remove the last coordinate it works every time as expected.
In 3.3.7 there are no problems with this.
I am drawing fairly short lines (indoor maps for a building) if that changes anything.
Right, after further testing it seems that its not lines that start and end at the same place, its polylines that perfectly matches a polygons outline that disappear (no calls for stroke color etc).
edit: Potentially its also because rendering order of overlays has changed?
We're experiencing the same issue. The actual use-case is that we want to draw a polyline with an outline and we do that by adding two polylines: one wider on the back and then another one on top. They both have the same coords.
I've identified that the issue is this line here https://github.com/mapbox/mapbox-gl-native/blob/62ea1f21858c69f6921c775ba7a3de201f0514d8/platform/ios/src/MGLMapView.mm#L2936
Introduced here: 751aff2ddd1770d9842c273f65e8aad768112151 cc @boundsj
This line prevent from adding two annotation that has the same set of coords. Comparator for polyline objects (and for other annotation types too) compares the actual coords one by one, I think author's intention was to compare only references to prevent two same objects being added.
Thanks for digging into this @kmagiera! I'll put this on the our 3.5.0 release milestone.
In the meantime, using the runtime styling API introduced in the Mapbox iOS SDK release 3.4.0 should not suffer from the same issue and would offer you many more styling options -- a single feature can visualized with multiple style layers.
Cool! thanks for a prompt response. In the meantime just wanted to post about the workaround that we use for polylines: we add one polyline with coords in a normal order and then the second polyline with coords in a reversed order. This prevents isEqual from returning true for these two polylines.
I've identified that the issue is this line here https://github.com/mapbox/mapbox-gl-native/blob/62ea1f21858c69f6921c775ba7a3de201f0514d8/platform/ios/src/MGLMapView.mm#L2936
Thanks for tracking this down! This line used to be innocuous, but #6559 implemented custom -isEqual: methods for the shape classes, which means we now deep-compare annotations before adding them. I think we鈥檇 only want to consider pointer equality in this case, using -[NSArray indexOfObjectIdenticalTo:].
we add one polyline with coords in a normal order and then the second polyline with coords in a reversed order
I would鈥檝e suggested a simpler workaround of varying the title property, but that led me to #8351.
@kmagiera, another workaround is to vary the title or subtitle property.
A compounding factor is that -[MGLMultiPoint isEqual:] only requires the two objects to both be MGLMultiPoints, and MGLPolyline and MGLPolygon lack stricter class membership tests.
Fixed in #8355 on the release-v3.5.0-android-v5.0.0 branch.
Most helpful comment
Cool! thanks for a prompt response. In the meantime just wanted to post about the workaround that we use for polylines: we add one polyline with coords in a normal order and then the second polyline with coords in a reversed order. This prevents
isEqualfrom returning true for these two polylines.