HTML Google Maps V2静态地图

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HTML Google Maps V2静态地图相关的知识,希望对你有一定的参考价值。

<!-- Basic Boring 1 Point -->
http://maps.googleapis.com/maps/api/staticmap?zoom=14&size=400x300&maptype=road&markers=219+4th+Ave+N,+Seattle,+WA+98109&sensor=false

<!-- Slightly Less Boring 3 Point. -->
http://maps.googleapis.com/maps/api/staticmap?zoom=14&size=400x300&maptype=road&markers=219+4th+Ave+N,+Seattle,+WA+98109|200+2nd+Avenue+NorthSeattle,+WA+98109|325+5th+Ave+N,+Seattle,+WA+98109&sensor=false

<!-- 3 point, simple and desaturated with read roads -->
http://maps.googleapis.com/maps/api/staticmap?zoom=14&size=900x600&maptype=road&style=feature:all|element:all|visibility:simplified|saturation:-99&style=feature:road|element:all|hue:0x010000|saturation:100&style=feature:road.highway|element:all|hue:0x010000|saturation:100|lightness:-50&style=feature:transit|element:all|hue:0x010000|saturation:100&style=feature:water|element:all|visibility:simplified|saturation:100|hue:0x0033ff|lightness:-15&markers=219+4th+Ave+N,+Seattle,+WA+98109|200+2nd+Avenue+NorthSeattle,+WA+98109|325+5th+Ave+N,+Seattle,+WA+98109&sensor=false

<!-- 3 point, simple night style map with black land and red roads -->
http://maps.googleapis.com/maps/api/staticmap?zoom=14&size=900x600&maptype=road&style=feature:all|element:all|visibility:simplified&style=feature:all|element:all|saturation:-100|lightness:-50&style=feature:road|element:all|hue:0x010000|saturation:100|lightness:-50&style=feature:water|element:all|visibility:simplified|lightness:-100&markers=219+4th+Ave+N,+Seattle,+WA+98109|200+2nd+Avenue+NorthSeattle,+WA+98109|325+5th+Ave+N,+Seattle,+WA+98109&sensor=false

<!-- 3 point, super saturated with no street labels -->
http://maps.googleapis.com/maps/api/staticmap?zoom=14&size=900x600&style=feature:all|element:geometry|saturation:100&style=feature:road|element:all|visibility:simplified&maptype=road&markers=219+4th+Ave+N,+Seattle,+WA+98109|200+2nd+Avenue+NorthSeattle,+WA+98109|325+5th+Ave+N,+Seattle,+WA+98109&sensor=false

Google Maps API 地理编码 <> 静态地图?

【中文标题】Google Maps API 地理编码 <> 静态地图?【英文标题】:Google Maps API Geocoding <> Static Map? 【发布时间】:2017-04-23 05:00:25 【问题描述】:

当我尝试获取以下地址的纬度和经度时,我得到了“ZERO_RESULTS”,但它在下面的静态地图请求中显示正常。有谁知道为什么? (一般其他地址都可以正常使用。)

地理编码网址

http://maps.google.com/maps/api/geocode/xml?address=Bali+Zoo+Jl.+Raya+Singapadu+Banjar+Seseh+Sukawati+Batuan+Sukawat%2c+Singapadu%2c+Sukawati%2c+Kabupaten%2c+Gianyar+-%2c+Bali%2c+Indonesia&sensor=false

回应:

零结果

静态地图网址

http://maps.googleapis.com/maps/api/staticmap?center=Bali+Zoo+Jl.+Raya+Singapadu+Banjar+Seseh+Sukawati+Batuan+Sukawat%2c+Singapadu%2c+Sukawati%2c+Kabupaten%2c+Gianyar+-%2c+Bali%2c+Indonesia&zoom=16&scale=2&size=300x160&maptype=roadmap&format=png&visual_refresh=true&markers=size:mid%7Ccolor:blue%7Clabel:%7CBali+Zoo+Jl.+Raya+Singapadu+Banjar+Seseh+Sukawati+Batuan+Sukawat%2c+Singapadu%2c+Sukawati%2c+Kabupaten%2c+Gianyar+-%2c+Bali%2c+Indonesia

静态地图响应:

【问题讨论】:

对我来说这看起来像是一个“地方”,Places API 应该能够解决它。 place API request (您的“地址”也被过度指定了)。地理编码 API 用于邮政地址,而不是地点。 奇怪,因为即使是 Places API 也将地址显示为“Jl. Raya Singapadu Banjar Seseh Sukawati Batuan Sukawati Gianyar Bali, Singapadu, Sukawati, Kabupaten Gianyar, Bali 80582, Indonesia (-8.5915798, 115.26561730000003)”在页面底部。我想最好的方法是首先尝试maps.google.com/maps/api/geocode,如果没有返回结果,那么在 Places API 中使用组织名称、州和国家?我不确定每个地址(例如不那么重要的企业)是否都是一个地方? developers.google.com/maps/documentation/geocoding/… 谢谢。这是一个有用的评论。非常感谢。 【参考方案1】:

根据 geocodezip 的评论,https://developers.google.com/maps/documentation/geocoding/best-practices 很有帮助。

【讨论】:

以上是关于HTML Google Maps V2静态地图的主要内容,如果未能解决你的问题,请参考以下文章

如何使用适用于 Android V2 的 Google Maps 处理地图移动端?

谷歌地图 V2 中的错误 java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment

Google Maps Android API v2 - 检测地图上的触摸

Google Maps Android API v2 - 简单的地图应用程序崩溃

Google Maps v2 上的动画标记

带有 API KEY 的 Google Maps V2 Android 显示为空白