Skip to content

Allow any vector tile style #51

@gmaclennan

Description

@gmaclennan

Right now the marker sprites need to be added to any vector tile style that is used. mapbox-gl-js currently only allows one sprite sheet per style, so you need to use Mapbox Studio to add the marker sprites to the style online. Ideally we want to enable any custom style to be used as a background in MapFilter, without modifying the sprites.

My current strategy for solving this is to concatenate the remote sprite file from the map style with the sprite for the marker sprites, using concat-sprites. This can be done dynamically in the browser, but getting the new merged sprite into mapbox-gl-js is a challenge. We could serve the sprite over an objectURL but mapbox-gl-js currently expects both the json and png to share the same url root. We could serve both using Service Workers, but with limited browser support, or create a fork of mapbox-gl-js and write a custom image_sprite.js. I'm thinking the latter might be the easier (hacky) solution for now. Hopefully Mapbox will support dynamic sprites in the near future.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions