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.

Incorrect URL generated in MapboxStaticImage when using StaticMarkerAnnotation without label #9107

Closed

Description

@TheIronMarx

Platform: Android
Mapbox SDK version: 5.0.2

Steps to trigger behavior

  1. Use MapboxStaticImage.Builder() to build a MapboxStaticImage that uses the StaticMarkerAnnotation to build a marker that has a name, lat, long, color and nothing else. Notice the lack of a label to accompany the name.
  2. The builder should otherwise be valid, with key, size, style, etc.
  3. .build() the MapboxStaticImage.Builder and run code. Observe the URL produced.

Expected behavior

The URL is valid.

Actual behavior

The URL is invalid. The problem lies with the part of the URL representing the marker. The following is an example of the invalid URL.

https://api.mapbox.com/styles/v1/mapbox/streets-v10/static/pin-s-+4990e2(-122.46589,37.77343)/auto/1032x540?access_token=pk.eyvalidkey

The invalid section is this: pin-s-+4990e2(-122.46589,37.77343). There is a hanging - before the hexcolor +4990e2where the (absent) label goes. It can be corrected by scrapping the hanging - so that the resulting section is pin-s+4990e2(-122.46589,37.77343).

The complete, correct URL should be

https://api.mapbox.com/styles/v1/mapbox/streets-v10/static/pin-s+4990e2(-122.46589,37.77343)/auto/1032x540?access_token=pk.eyvalidkey

Activity

  1. TheIronMarx commented on May 25, 2017

    @TheIronMarx
    Author

    In the mean time, here's my workaround.

    private String correctMissingLabel(String staticImageUrl) {
            // Potential bug if "-+" is a substring of our Mapbox key. It isn't, so it's fine. I don't even think those are valid characters.
            return staticImageUrl.replace("-+", "+");
        }
    
  2. added
    Android
    annotations
    on May 26, 2017
  3. Guardiola31337 commented on Jun 12, 2017

    @Guardiola31337
    Contributor

    @TheIronMarx thanks for reaching out and reporting your problem.

    This should be fixed when mapbox-java#479 lands.

    Closing here. Thanks again and let us know if you find any other issues 👍

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

Metadata

Metadata

Labels

Androidannotations

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions