如何提示用户在JavaScript中使用Google地图的地方? [英] How to prompt user for place using Google Maps in javascript?

查看:92
本文介绍了如何提示用户在JavaScript中使用Google地图的地方?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Google地图很陌生,但对Javascript仍然陌生。我需要让用户在地图上选择一个位置(使用Google Map)并检索相应的城镇,国家,经度和纬度。如果时区可用,那就太好了。



我找不到一个操作代码示例。有没有人有分享? /maps/documentation/javascript/examples/event-arguments.htmlrel =noreferrer> http://code.google.com/apis/maps/documentation/javascript/examples/event-arguments.html 从鼠标单击获取LatLng并在地图上放置标记。 (请查看源代码以查看示例代码。)



Google提供的示例代码位于 http://code.google.com/apis/maps/documentation/javascript/examples/geocoding-reverse.html 通过反向地理编码获取纬度和经度并确定位置。 (同样,查看源代码以查看示例。)



听起来像您的功能基本上是每个示例的一部分并将它们融合在一起。



您可能想查看活动文档反向地理编码文档,如果遇到任何问题问题(或者即使你不这样做)。


I am new to Google Maps and still new to Javascript. I need to have a user select a location on a map (using Google Map) and retrieve the corresponding town, country, latitude and longitude. If timezone is available too, that would be great.

I can't find an operational code example. Does anyone have one to share? Thanks.

解决方案

The sample code provided by Google at http://code.google.com/apis/maps/documentation/javascript/examples/event-arguments.html gets a LatLng from a mouse click and puts a marker on a map. (Just view the source code to see the sample code.)

The sample code provided by Google at http://code.google.com/apis/maps/documentation/javascript/examples/geocoding-reverse.html takes a latitude and longitude and determines the location via reverse geocoding. (Again, view source code to see the sample.)

Sounds like your functionality is basically parts of each of those samples and fusing them.

You might want to check out the Events documentation and the Reverse Geocoding documentation if you run into any problems (or even if you don't).

这篇关于如何提示用户在JavaScript中使用Google地图的地方?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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