Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding custom marker text to Google Map

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?
like image 305
user3871 Avatar asked Jun 26 '14 03:06

user3871


People also ask

Can you put markers on Google Maps?

You can add a simple marker to the map at a desired location by instantiating the marker class and specifying the position to be marked using latlng, as shown below.


2 Answers

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"));
like image 63
João Marcos Avatar answered Sep 28 '22 12:09

João Marcos


Yo can set the Latitude and Longitude of your marker and include a Title on it.

var marker = new google.maps.Marker({
    position: new google.maps.LatLng(-25.363882,131.044922),
    map: map,
    title: 'Our Office'
});
like image 20
Alvin Magalona Avatar answered Sep 28 '22 11:09

Alvin Magalona