Google Maps API (static) - custom marker not showing up

混江龙づ霸主 提交于 2019-12-18 14:54:05

问题


URL:
http://maps.google.com/maps/api/staticmap?center=40.714728,-73.998672&markers=icon:http://tinyurl.com/2ftvtt6&zoom=12&size=400x400&sensor=false

I have no clue what I'm doing wrong here.

Developer Guide:
API - Custom Icons

...markers=icon:url[stop]&zoom=...


回答1:


It seems that you defined marker style, but didn't define marker location. It should be:

http://maps.google.com/maps/api/staticmap?center=40.714728,-73.998672&markers=icon:http://tinyurl.com/2ftvtt6|40.714728,-73.998672&zoom=12&size=400x400&sensor=false




回答2:


I had some problems with the markers, too.

Maybe these hints help other guys

  • Marker should be max 64x64 pixels in size
  • long marker filenames can cause issues
  • always define a marker location - see accepted answer



回答3:


Another point I wanted to add for future reference. Don't use svg files. They won't be rendered in the final map image.



来源:https://stackoverflow.com/questions/4180006/google-maps-api-static-custom-marker-not-showing-up

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!