Label/Sticky Title - Google Maps Api

Asked

Viewed 767 times

2

I’m working with the Google Maps Api, and need to leave the name statically appearing above/below the Marker, I wanted to put this label/title when creating the Marker, as the title, someone knows a simple way to do this ?

I’d like something like that :

inserir a descrição da imagem aqui

My Masrker is being incited this way:

 var marker = new google.maps.Marker({
   position: { lat: lat, lng: lng },
   map: map,
   title: localizacao.message.nome,
   icon: '../Content/imagens/Icones/Markers/green-marker.png'
 });

Thank you very much.

1 answer

1


You can put the label in this way:

var marker = new google.maps.Marker({
  position: myPosition,
  label: 'Nome do Marker',
  map: map
});

She’ll be in the middle of the icon you chose, I already use this API of Maps for some time and I haven’t figured out how to change this shape that appears, but when I need to leave exactly as I want I create the image in an image editing program and put it in icon, exactly as you put the green-marker.png.

  • 1

    Thank you very much, I just left an infowindow open by default but already helped me enough your answer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.