Change default Google map pin color

0

Good morning, this is my first question here, so if I do something out of the standard I apologize in advance.

I need to change the default color of the google maps pin to some hexadecimal value, would it be possible? I already anticipate that I can not create pngs of each color and search for a url because the color comes from the database.

Hereismycodebelow:

var marcador = new MarkerWithLabel
({
  position    : {lat: parseFloat (dados.latitude), lng: parseFloat (dados.longitude)},
  raiseOnDrag : true,
  map         : mapa,
  icon        : // preciso fazer algo aqui para que o pin assuma a co com base no hexadecimal que vem da variável
  visible     : true
});

Thank you in advance

    
asked by anonymous 14.12.2018 / 12:48

1 answer

0

There are some different color markers you can use; blue , purple , purple , yellow , verde .

Then you can use the structure you put in the question and put one of these markers as icon :

var marcador = new MarkerWithLabel
({
  position    : {lat: parseFloat (dados.latitude), lng: parseFloat (dados.longitude)},
  raiseOnDrag : true,
  map         : mapa,
  icon        : 'http://maps.google.com/mapfiles/ms/icons/yellow-dot.png hexadecimal'
  visible     : true
});

You can take a look at in this answer of soen which is more or less what you intend to do.

    
14.12.2018 / 12:53