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.

[WARNING] {}[Render]: can't find source for layer - IOS #7976

Closed

Description

Hi,

I am getting this warning in console [WARNING] {}[Render]: can't find source for layer when i tried to add MGLStyleLayer on mapview,

   func handleLongTap(longRecog: UILongPressGestureRecognizer) {
    
       let location = longRecog.location(in: self.mapView)
       let touchableSquare = buffer(location: location, length: 10.0)

       let features = self.mapView.visibleFeatures(in: touchableSquare)
       let shapeFeatures = features.map { return $0 as! MGLShape }
    
       let source = MGLShapeSource(identifier: "features", features: shapeFeatures, options: nil)
      
       let styleLayer = MGLCircleStyleLayer(identifier: "features", source: source)

       styleLayer.circleColor = MGLStyleValue(rawValue: .cyan)
       styleLayer.circleRadius = MGLStyleValue(stops: [
           1: MGLStyleValue(rawValue: 5),
           18: MGLStyleValue(rawValue: 3),
           ])
       styleLayer.circleOpacity = MGLStyleValue(rawValue: 0.5)
       self.mapView.style?.addLayer(styleLayer)
   }

   private func buffer(location: CGPoint, length:Double) -> CGRect {
       return CGRect(x: Double(location.x - CGFloat(length / 2)), y: Double(location.y - CGFloat(length / 2)), width: length, height: length)
   }

Activity

  1. added
    iOS
    on Feb 8, 2017
  2. boundsj commented on Feb 8, 2017

    @boundsj
    Contributor

    Hi @ThiyagarajanShivSankaran, thanks for reaching out. Please have a look at our help resources and contact us through the form there if you cannot find a solution to your issue.

    Specifically, please check out the relevant API documentation and guides.

    In this case, it looks like you did not add your source to the mapView's style (via addSource()).

  3. friedbunny commented on Feb 8, 2017

    @friedbunny
    Contributor

    @ThiyagarajanShivSankaran If you have a bug to report, please follow the issue template. Otherwise, this is not a forum for support or code review.

  4. 1ec5 commented on Feb 8, 2017

    @1ec5
    Contributor

    #7988 would help developers avoid the mistake demonstrated in this issue.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    iOSruntime stylingsupport

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions