Using Google API - GClientGeocoder()

2020-07-09 05:32发布

I try to follow this page:

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

but GClientGeocoder() is not defined - there is an error.

I already us the google maps api on my page:

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

How to resolve my error?

Here is how I succesfuly use the API:

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

1条回答
forever°为你锁心
2楼-- · 2020-07-09 06:12

GClientGeocoder() is a Version 2 object. You are loading the Version 3 API and need to use Version 3 objects and methods.

The Version 3 equivalent is google.maps.Geocoder() and is described in the documentation. It's not the same as the Version 2 implementation.

查看更多
登录 后发表回答