Skip to content

Path limit #76

Open
Open

Description

@riki-dexter

Hi, is there a limit to coordinates array length to build a path overlay?
I need to draw about 3000 CLLocationCoordinate2D on the map, but i'm getting
MBStaticErrorDomain" - code: 18446744073709551615
when getting image from Snapshot object.
Until 1500 CLLocationCoordinate2D works well, I'm getting right the map.

Thank you.

Activity

  1. frederoni commented on Apr 19, 2018

    @frederoni
    Contributor

    I'm not aware of any limitations on the snapshot. Would you mind sharing a code snippet?

  2. riki-dexter commented on Apr 19, 2018

    @riki-dexter
    Author

    I wrote this code:

                   var pathArr = [CLLocationCoordinate2D]()
                   for workoutLocation in self.workoutLocations {
                        pathArr.append(workoutLocation.coordinate)
                    }
                                    
                    var path = Path(coordinates: pathArr)
                    path.strokeWidth = 2
                    path.strokeColor = .black
    
                    let options = SnapshotOptions(
                        styleURL: URL(string: "mapbox://styles/r****")!,
                        size: CGSize(width: 200, height: 200))
                    options.overlays = [path]
                    let snapshot = Snapshot(
                        options: options,
                        accessToken: "****")
    
                    snapshot.image { (image, error) in
                        let img: UIImage = image!
                        print("")
                    }
    
  3. frederoni commented on Apr 19, 2018

    @frederoni
    Contributor

    I don't see any issues when using 3000 coordinates but I start getting "MBStaticErrorDomain Code=-1 server errors" after 4000. Might be due to the custom style. @1ec5 do you know if we have any hard limitations on the number of coordinates in a path?

    If you are using the Maps SDK for iOS, it might be of interest to use the newly introduced MGLMapSnaphotter which renders the snapshot client side.

  4. riki-dexter commented on Apr 19, 2018

    @riki-dexter
    Author

    How can I set path overlay to MGLMapSnapshotOptions?

    Thank you

  5. frederoni commented on Apr 19, 2018

    @frederoni
    Contributor

    You would have to add an MGLPolylineFeature to the map view itself. Similar to https://www.mapbox.com/ios-sdk/examples/line-geojson/

  6. riki-dexter commented on Apr 19, 2018

    @riki-dexter
    Author

    Sorry but I don't have a map view. I only have an array of CLLocationCoordinate2D and I would get an image of the map fragment with the overlay path.

  7. frederoni commented on Apr 19, 2018

    @frederoni
    Contributor

    Sorry but I don't have a map view.

    Ok, then the static api is the way to go. Trying to figure out if there is a limit.

  8. 1ec5 commented on Apr 20, 2018

    @1ec5
    Contributor

    do you know if we have any hard limitations on the number of coordinates in a path?

    Not on the number of coordinates specifically, but according to the Static API documentation, there is a restriction on the number of features in a GeoJSON overlay, as well as a restriction on the length of the string encoding of all the overlays combined:

    Overlays cannot consist of more than 100 features. The maximum overlay length is 2083 characters.

    A Path’s string-encoded length depends on the Polyline encoding of all the coordinates, plus any styling options.

  9. naixu9x commented on Jul 26, 2023

    @naixu9x

    Hi, a long time passed, how is this issue going?
    Do we have any number of limit coordinates to pass to the Path?

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions