-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
icon-image base64 support #4816
Comments
I really need this feature, the html markers is not supported with clustering and I have a shit load of icons to load and the "addImage" is limited by the "AtlasSprite" size. |
I know this has been brought up again and again, but I couldn't find a proper solution to support the way we want our markers to be shown and ability to form cluster, drag, drop, filter etc. ( Design wise, our markers consists of two layers, background: where users select color and foreground where the user selects the icon. Colors and Icons are dynamically selected. Is it possible to create markers like above with |
Does this trick help you? I find this approach a bit more flexible than using external URLs because external requests are not needed. Not as elegant as using base64 from icon-image directly:
|
In your example your base64 image is not generated based on feature properties. My use case is using d3.js in order to generate a custom icon based on a feature props. For now, I switch from/to layer/htmlmarker depending on the number of symbol currently visible. |
This is also an issue for a project I am working. We consume a GeoJSON that is a feature collection of aircraft locations, heading, etc. Each feature includes a base64 encoded icon for that type of aircraft. Ideally we should be able to to reference the properties that contain the icons and heading and have it render. Using the loadImage method is very clunky and not appropriate for our use-case. |
I'm not using mapbox-gl currently, but this seems to solve this issue: #7987 🎉 |
Motivation
Having custom icon image per feature. Icons may be different depending their data.
A the moment, we need call
addImage
in order to add custom icon-image, but it's not appropriate if each feature have differents image (and if these images are generated based on feature data).Design
data-driven generation of icon-image would be ideal, but we can't have js callback inside styling as far I know.
The source server could calculate the base64 image for each feature into a
icon
property, and then we just have to set something like:I know that html markers can do this, but they're not as smooth as symbol layers.
The text was updated successfully, but these errors were encountered: