将自定义标记文字添加到Google地图 [英] Adding custom marker text to Google Map
问题描述
我为新的律师事务所创建了一个新网站。
我遵循Google API嵌入地图。我添加了他们的地址,但想要将公司的名称添加到地图中...您可以在地图中看到它不会捕获名称:
< iframe width =600height =450frameborder =0style =border:0src =https://www.google.com/maps/ ?嵌入/ V1 /位键= myapikey&安培; q = 883%20Farmington%20Avenue%2C%20Berlin%2C%20CT%2006037%2C%20United%20States>< / iframe中>
因此,我试图在iframe中的地址之前添加一个名称:
q = Jill + Levin + Law,地址在这里...
但我猜关键字 Levin
挑选匹配公司 Soulsby& Levin,LLC
...即使我没有更改地址
< iframe width =600height =450frameborder =0style =border:0src =https://www.google.com/maps/embed/v1/place?key=myapikey&q=Jill+莱+法,883%20Farmington%20Avenue%2C%20Berlin%2C%20CT%2006037%2C%20United%20States>< / iframe中>
甚至Google API本身也会根据关键字挑错:
请问我:
$ b
map.addMarker(new MarkerOptions()。title(Office Name));
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>
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>
Even the Google API itself picks up the wrong one based on the keyword:
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?
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"));
这篇关于将自定义标记文字添加到Google地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!