【发布时间】:2010-11-21 14:26:49
【问题描述】:
我正在阅读 Google 的 API,但没有看到任何示例,所有其他 Google 搜索的示例都有些陈旧(大约 1-2 岁,大多数是基于 API 密钥的 :S)。
我想要一个文本输入。发送按钮。和下面的 iframe。
如何使用我自己的输入在地图上显示位置?
此时我的 iframe 看起来像这样:
<iframe width="230" height="180" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="<?php echo $src ?>">
输入:
<input id="googleMaps" name="googleMaps" type="text" />
此时我正在尝试使用 XML(但据我所知推荐使用 JSON?),但我在 iframe 中获取的 XML 只是文本,例如:
This document had no style information.
<GeocodeResponse>
<status>
OK
</status>
<result>
<type>
locality
</type>
<type>
political
</type>
<formatted_address>
(...)
如何将这些数据传递给 Google 并取回地图? :)
非常感谢。
【问题讨论】:
-
我建议你看看 JavaScript API,因为你想在地图上显示结果。 code.google.com/apis/maps/documentation/javascript/basics.html有地理编码的例子。
-
你没有提到你需要什么样的地图,但你可能会发现静态地图更容易使用:code.google.com/apis/maps/documentation/staticmaps。您只需要几个基本工具:cURL 和 SimpleXML。
-
不幸的是,我要显示动态地图(用户键入地址,如“blabla, New York, NY”,它会显示带有缩放选项等的地图。我真的需要为此使用外部脚本吗? ? ;s
标签: php google-maps google-maps-api-3