Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom dynamic markers #2260

Closed
normanrz opened this issue Mar 13, 2016 · 2 comments
Closed

Custom dynamic markers #2260

normanrz opened this issue Mar 13, 2016 · 2 comments

Comments

@normanrz
Copy link

For my project I need to create custom markers dynamically. Currently, I am using the 2D Canvas API to draw icons on a custom layer in Google Maps. For performance reasons I'm interested in switching to Mapbox GL.
I understand that WebGL works with textures that have to be loaded into the graphics context. Afaik Mapbox GL currently only allows spritesheets that have been built through Mapbox studio.
Would it be possible to add support for dynamically created spritesheets (ie. the spritesheets are drawn at runtime using the Canvas API)?

Related issues: #358, #1760, #656.
Demo of my project: http://racemap.de/player/haj-hannover-marathon-42km_2015-04-19/

@lucaswoj
Copy link
Contributor

For all intents and purposes, this is a duplicate of #358.

Having taken a quick glance at your application, I recommend using the same approach we use for highway labels in Mapbox streets:

  • pre-generate a number of label backgrounds at different widths
  • add a {width} property to your data
  • select the background at runtime using tokens in the icon-image property

@normanrz
Copy link
Author

Thanks! Really appreciate you taking the time to look into my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants