在谷歌静态地图上使用自定义图像标记? [英] Using a custom image marker on google static map?

查看:546
本文介绍了在谷歌静态地图上使用自定义图像标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是我尝试过的,但它有默认的标记图像



有关更多信息,请查看谷歌地图API,还有更多信息,如大小,标记位置,中心地图,地图类型等。



https://developers.google.com/maps/documentation/static -maps / intro#MapTypes



*如果图标img没有出现,它将是图片的大小,请尝试使用另一个大小,少一些如果没有出现对公共请求(外部请求)的图像检查超过64x64像素,图像格式GIF,JPEG和PNG,则文档建议使用PNG...

how to have custom image marker on google static map, i need url format:

this is what i have tried, but its having default marker image http://maps.google.com/maps/api/staticmap?center=25.3176452,82.97391440000001,&zoom=15&markers=25.3176452,82.97391440000001|25.3176452,82.97391440000001&path=color:0x0000FF80|weight:5|25.3176452,82.97391440000001&size=175x175&sensor=TRUE_OR_FALSE

解决方案

This is what you want:

http://maps.googleapis.com/maps/api/staticmap?zoom=17&size=512x512&maptype=hybrid&markers=icon:http://cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico|34.052230,-118.243680

for a custom image, put the icon:url after of markers...

Format

icon:url|coords

Example

icon:http://cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico|34.052230,-118.243680

a result of my example

For more information check google maps api, there are more information like size, markers position, center map, map type... etc.

https://developers.google.com/maps/documentation/static-maps/intro#MapTypes

*If the icon, img, don't appear it will be the size of image, try with another size,less than 64x64 px, format of image, "GIF, JPEG and PNG", the documentation recommend "PNG", if it doesn't appear check permision of image for public request(external request)...

这篇关于在谷歌静态地图上使用自定义图像标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆