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

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

Closed

Description

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())
        }
    })
}

Activity

  1. added
    iOS
    on Jun 9, 2017
  2. added this to the ios-v3.6.0 milestone on Jun 16, 2017
  3. jmkiley commented on Jun 19, 2017

    @jmkiley
    Contributor
  4. added
    Core
    and removed
    iOS
    on Jun 19, 2017
  5. added
    release blocker
    on Jun 19, 2017
  6. boundsj commented on Jun 19, 2017

    @boundsj
    Contributor

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

  7. self-assigned this
    on Jun 19, 2017
  8. jmkiley commented on Jun 20, 2017

    @jmkiley
    Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Corebugrelease blockerruntime styling

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions