Adding custom marker text to Google Map

Growler picture Growler · Jun 26, 2014 · Viewed 13k times · Source

I'm creating a new website for new law office.

I followed Google API for embedding maps. I added their address, but would like to add the name of the firm to the map... You can see in the map, it doesn't capture the name:

<iframe width="600" height="450" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/place?key=myapikey&q=883%20Farmington%20Avenue%2C%20Berlin%2C%20CT%2006037%2C%20United%20States"></iframe>

enter image description here

So, I tried adding a name before the address in the iframe:

q=Jill+Levin+Law,address here...

But I'm guessing the keyword Levin pick ups a matching firm, Soulsby & Levin, LLC... even though I haven't changed the address

<iframe width="600" height="450" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/place?key=myapikey&q=Jill+Levin+Law,883%20Farmington%20Avenue%2C%20Berlin%2C%20CT%2006037%2C%20United%20States"></iframe>

enter image description here

Even the Google API itself picks up the wrong one based on the keyword:

enter image description here

How do I:

  • Have Google map pick up the correct name of the office
  • If the office name hasn't been defined yet, how can I simply add the text name to the top of the marker?

Answer

Jo&#227;o Marcos picture João Marcos · Jun 26, 2014

When you add the marker to the map you can put a title to the marker.

Use this code to do it:

map.addMarker(new MarkerOptions().title("Office Name"));