我想打电话给googleapi,但失败了

时间:2019-10-21 12:44:44

标签: android android-studio

我引用了搜索过的程序,并使用了两个函数调用googleapi snap-to-road但得到IOException,我不知道该如何解决

我参观了 网站(https://developers.google.com/maps/documentation/roads/snap)并按照这种方式

private String buildRequestUrl(List<LatLng> trackPoints) {
        StringBuilder url = new StringBuilder();
        url.append("https://roads.googleapis.com/v1/snapToRoads?path=");

        for (LatLng trackPoint : trackPoints) {
            url.append(String.format("%8.5f", trackPoint.latitude));
            url.append(",");
            url.append(String.format("%8.5f", trackPoint.longitude));
            url.append("|");
        }
        url.delete(url.length() - 1, url.length());
        url.append("&interpolate=true");
        url.append("&key=myKey");
        Log.i("brad","url is "+url);
        return url.toString();
    }

打开异常,我收到消息

{
  "error": {
    "code": 404,
    "message": "Requested entity was not found.",
    "status": "NOT_FOUND"
  }
}

0 个答案:

没有答案