0

我知道如何使用 lac、ci 参数以 json 格式反向配对谷歌地图,但我
找不到像这样使用 lat、long 参数进行解析的方法,这不可能吗?
提前谢谢。

4

2 回答 2

0

试用Google 地理编码 API

于 2011-06-27T08:21:34.600 回答
0

由于您使用google-maps关键字对此进行了标记,因此您也可以直接从 Google Maps 中使用 Geocoding API(例如 Gmaps API V3):

    gmaps.geocoder.geocode({ 'address': address }, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
            var marker = new google.maps.Marker({
                map: gmaps.map,
                position: results[0].geometry.location,
            });

            marker.setTitle(address);

            gmaps.bounds.extend(results[0].geometry.location);
            gmaps.map.fitBounds(gmaps.bounds);

            if(typeof(callback) === 'function') {
                callback(marker);
            }
        } else {
            console.log("Geocode was not successful for the following reason: " + status);
        }
    });

此代码段将获取地址的几何位置,并将其绘制在地图中(位于 gmaps.map 中)。它还将确保所有标记都适合地图的范围。

于 2011-06-27T08:28:03.953 回答