谷歌地图 - 获取信息窗口显示? [英] Google Maps - Getting the info window to show?

查看:124
本文介绍了谷歌地图 - 获取信息窗口显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前已经成功显示Google地图,它看起来像这样:





我阅读了此网页: http:/ /code.google.com/apis/maps/documentation/javascript/overlays.html#InfoWindows ,但这似乎只解释了如何使用自己的自定义内容创建信息窗口。我只想显示上面的例子中的信息,您可以在许多网站上看到这些信息。

您可以使用Places API:



http://代码.google.com / apis / maps / documentation / places /

或者Google地图库(Google Maps JS API的一部分):



http://代码。 google.com/apis/maps/documentation/javascript/places.html



您将在JS中解析响应,然后设置infowindow的内容如所须。请注意,从商家信息中(至少在Google的域名上)提取内容以填充信息内容违反了服务条款。



以下是一个基本示例:



http: //code.google.com/apis/maps/documentation/javascript/examples/place-details.html


I've currently got a Google Map showing successfully and it looks like this:

I want it to show with the info window showing by default, like this example:

I read this page: http://code.google.com/apis/maps/documentation/javascript/overlays.html#InfoWindows but that seemed to only explain how to make an info window with your own custom content. I just want to show the info like the example above where you see on many sites.

解决方案

You can use the Places API:

http://code.google.com/apis/maps/documentation/places/

Or the Places Library (part of the Google Maps JS API):

http://code.google.com/apis/maps/documentation/javascript/places.html

You'll parse the response in JS and then set the content of the infowindow as needed. Note that scraping content from business listings (at least on Google's domains) to fill your infowindows is against the terms of service.

Here is a basic example:

http://code.google.com/apis/maps/documentation/javascript/examples/place-details.html

这篇关于谷歌地图 - 获取信息窗口显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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