Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google maps 在执行反向地理编码时,我做错了什么_Google Maps_Google Maps Api 3 - Fatal编程技术网

Google maps 在执行反向地理编码时,我做错了什么

Google maps 在执行反向地理编码时,我做错了什么,google-maps,google-maps-api-3,Google Maps,Google Maps Api 3,我正在尝试反向地理编码,我有三个坐标,我想把它们转换成地址,我使用了下面的方法 var point1 = new google.maps.LatLng(latLng1); var point2 = new google.maps.LatLng(latLng2); var point3 = new google.maps.LatLng(latLng3); where latLng1, latLng2, latLng3 are coordinates. and then further I

我正在尝试反向地理编码,我有三个坐标,我想把它们转换成地址,我使用了下面的方法

var point1 = new google.maps.LatLng(latLng1);

var point2 = new google.maps.LatLng(latLng2);

var point3 = new google.maps.LatLng(latLng3);

where latLng1, latLng2, latLng3 are coordinates.

and then further I want to use these addresses to following code to create a path

var request = {

        origin:location1, 

        destination:location2,

        waypoints:[{location: point1}, {location: point2}, {location: point3}],

        travelMode: google.maps.DirectionsTravelMode.WALKING

        };
但它从不显示任何东西


我做得对吗?谷歌APIv3中还说了一件事,我们可以在航路点或latlng中使用地址字符串。我们如何在航路点使用latlag。

您是否在此处显示了您的全部代码? 例如,请发布您的latLng1值。 另外,显示您的方向服务呼叫。我喜欢这样:

    directionsService.route(request, function(response, status) {
        if (status == google.maps.DirectionsStatus.OK) {
            directionsDisplay.setDirections(response);
        } else alert(status);
    });
在任何情况下-try do alert()您的请求状态、说明可能不适用于这些点


顺便说一句,你不需要将你的坐标反编码为地址来获得方向。您可以在航路点中使用坐标,这就是您在这里所做的。

您输入坐标以获取地址,然后将地址输入到pathfinder,当pathfinder没有输出时,您是否确定没有正确提供地址?你试过测试给出的地址吗?@b事实上我不知道如何给谷歌提供的这个航路点函数加上latLng,我知道我们也可以给航路点函数加上地址。例如“例如航路点:[{location:london},{location:sussex},{location:manchester}],但我不确定如何在航路点中给出lat和lng。