Shekhu
Shekhu

Reputation: 2020

Polyline drawn is showing below buildings

The polyline is drawn showing below building.

enter image description here enter image description here
(source: gifyu.com)

How can I get the polyline top of all layers

please suggest

adding polyline as

   var coordinates = locationsArrToAdd.map({ (location: CLLocation!) -> CLLocationCoordinate2D in
        return location.coordinate
   })
    
   let polyline = MKPolyline(coordinates: &coordinates, count: locationsArrToAdd.count)
    
   self.mapView.addOverlays([polyline], level: .aboveLabels)

Upvotes: 4

Views: 229

Answers (1)

Nick Gagne
Nick Gagne

Reputation: 130

According to Apple, the highest available level you can add an overlay to is the MKOverlayLevel.aboveOverlays constant you are currently using. However, their documentation states that this will:

Place the overlay above map labels, shields, or point-of-interest icons but below annotations and 3D projections of buildings.

From what I can see, the best solution is to disabled buildings in 3D mode, so that your polylines are visible:

self.mapView.showsBuildings = false

Upvotes: 0

Related Questions