aws-amplify / maplibre-gl-js-amplify

Apache License 2.0
14 stars 10 forks source link

Change marker icons or colors for different locations #214

Open narutaro opened 1 year ago

narutaro commented 1 year ago

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?

sreeramsama commented 1 year ago

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.

narutaro commented 1 year ago

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

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