8

我尝试关注此页面:

http://melandri.net/2009/07/03/get-location-coordinates-using-google-maps/

但未定义 GClientGeocoder() - 存在错误。

我已经在我的页面上使用了谷歌地图 API:

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=<%=System.Web.Configuration.WebConfigurationManager.AppSettings["myGoogleKey"]%>&sensor=false"></script>

如何解决我的错误?

以下是我成功使用 API 的方法:

var map = new google.maps.Map(document.getElementById("map_canvas"),
        myOptions);
4

1 回答 1

22

GClientGeocoder()是版本 2 对象。您正在加载版本 3 API 并且需要使用版本 3 对象和方法。

版本 3 的等效版本是google.maps.Geocoder()并且在文档中进行了描述。它与第 2 版实现不同。

于 2012-04-18T16:50:35.470 回答