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.

Pass custom parameters to styleURL #5485

Closed

Description

@ambientlight

I need to integrate the Bing Maps datasource into the styleURL, however instead of /z/x/y.png it uses quadKey indexing, where quadKey can be defined as:

_quadKey: function (x, y, z) {
    var quadKey = [];
    for (var i = z; i > 0; i--) {
        var digit = '0';
        var mask = 1 << (i - 1);
        if ((x & mask) != 0) {
            digit++;
        }
        if ((y & mask) != 0) {
            digit++;
            digit++;
        }
        quadKey.push(digit);
    }
    return quadKey.join('');
}

How can I make the styleURL eat a custom parameter in iOS and Android SDK? say for example something like:
https://somedatasource.com/{quadKey}.png

Activity

  1. 1ec5 commented on Jun 27, 2016

    @1ec5
    Contributor

    The styleURL property takes a URL to a Mapbox GL stylesheet, not a tile URL template. It is possible to craft a stylesheet that includes a raster tile layer, but raster tile layers currently only support a limited set of tokens such as {x}, {y}, and {z}. There’s no API for extending that tokenization – the relevant code lives deep down in src/mbgl/util/mapbox.cpp.

  2. ambientlight commented on Jun 27, 2016

    @ambientlight
    Author

    @1ec5 Thank you.

    Ok I guess I therefore need to setup the apache server with request redirecting...

  3. 1ec5 commented on Jun 30, 2016

    @1ec5
    Contributor

    mapbox/mapbox-gl-js#2805 proposes adding support for {quadkey} specifically in Mapbox GL JS. I don’t know whether or not that’s the right approach, but the equivalent code in the mapbox-gl-native codebase would be located in Resource::tile().

  4. added a commit that references this issue on Jul 9, 2016
    bb05211
  5. 1ec5 commented on Jul 9, 2016

    @1ec5
    Contributor

    #5628 implements {quadkey} support in tile URLs, as requested.

  6. added a commit that references this issue on Jul 12, 2016
    08d0a9a
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