Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

IOS : Updating MGLShapeSource with MGLShape is not working. #9229

Closed
ThiyagarajanShivSankaran opened this issue Jun 9, 2017 · 3 comments
Closed
Assignees
Labels
bug Core The cross-platform C++ core, aka mbgl release blocker Blocks the next final release runtime styling
Milestone

Comments

@ThiyagarajanShivSankaran

IOS:
ios-v3.6.0-beta.2

Steps to trigger behavior

  1. Create MGLShapeSource with MGLSymbolStyleLayer.
  2. Add shape array to MGLShapeSource, at first time it is working.
  3. But, if you pan or zoom the map view then add the updated shape array to MGLShapeSource, now for second time shapes are not updating.
  4. But if you click on map or tilt the map a bit then the old shapes are updating on map.

Expected behavior

  1. While adding array of shapes to MGLShapeSource it should update everytime with new shapes.

Actual behavior

  1. New shapes are not updating with MGLShapeSource.

Below is my code:

 func mapView(_ mapView: MGLMapView, regionDidChangeAnimated animated: Bool) {
    
    if self.mapView.style?.source(withIdentifier: "my-source") == nil {
       
        self.mySource = MGLShapeSource(identifier: "my-source", features: [], options: nil)
        self.mapView.style?.addSource(mySource!)
    }
    
    if self.mapView.style?.layer(withIdentifier: "my-layer") == nil {
        
        let myLayer = MGLSymbolStyleLayer(identifier: "my-layer", source: self.mySource!)
        myLayer.sourceLayerIdentifier = "my-source"
        myLayer.iconImageName = MGLConstantStyleValue<NSString>(rawValue: "my-icon")
        myLayer.isVisible = true
        self.mapView.style?.addLayer(myLayer)
    }
    
    DispatchQueue.main.async(execute: { [weak self] in
        if let mySource = self?.mapView.style?.source(withIdentifier: "my-source") as? MGLShapeSource {
            mySource.shape = MGLShapeCollectionFeature(shapes: self?.getShapes())
        }
    })
}
@Guardiola31337 Guardiola31337 added the iOS Mapbox Maps SDK for iOS label Jun 9, 2017
@boundsj boundsj added this to the ios-v3.6.0 milestone Jun 16, 2017
@jmkiley
Copy link
Contributor

jmkiley commented Jun 19, 2017

This should be fixed by #9110 37fa8ad#diff-12f94a363ba006ac75e7fba4eef3129cR36

@1ec5 1ec5 added bug Core The cross-platform C++ core, aka mbgl and removed iOS Mapbox Maps SDK for iOS labels Jun 19, 2017
@boundsj boundsj added the release blocker Blocks the next final release label Jun 19, 2017
@boundsj
Copy link
Contributor

boundsj commented Jun 19, 2017

Confirmed this issue using the Update Shape: * debugging tests in iosapp and just tagged this as a release blocker.

@jmkiley
Copy link
Contributor

jmkiley commented Jun 20, 2017

#9303 cherry-picks a fix for this issue into the v3.6.0 release branch.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Core The cross-platform C++ core, aka mbgl release blocker Blocks the next final release runtime styling
Projects
None yet
Development

No branches or pull requests

6 participants