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

Change marker icons or colors for different locations #214

Open
narutaro opened this issue Apr 16, 2023 · 2 comments
Open

Change marker icons or colors for different locations #214

narutaro opened this issue Apr 16, 2023 · 2 comments
Labels
feature-request Request a new feature

Comments

@narutaro
Copy link

narutaro commented Apr 16, 2023

I like to create an application to show a different icon for each location, or change the color of the icon depending on location conditions, is that possible?

I looked at this drawPoints - markerImageElement example but it looks that the same icon will be applied to all icons on the map.

Is there a sample code available?

@narutaro narutaro changed the title Marker image or color for each place Change marker icons or colors for different locations Apr 16, 2023
@0618 0618 added the question General question label Apr 22, 2023
@sreeramsama
Copy link
Contributor

sreeramsama commented Apr 24, 2023

The drawPoints functionality only accepts an array of coordinate data of markers and options to configure marker elements, but as of now, there is no way to set icons/colors to each marker/location.

You could try creating a custom marker with specific icons/colors using maplibregl marker and add it to a map.

@sreeramsama sreeramsama added enhancement feature-request Request a new feature and removed question General question enhancement labels Apr 25, 2023
@narutaro
Copy link
Author

@sreeramsama - thank you for your reply. I will go with the MapLibre API for now.

const m = new maplibregl.Marker({
  color: "#e50112",
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request a new feature
Projects
None yet
Development

No branches or pull requests

3 participants