Google maps 找到附近的血库

Google maps 找到附近的血库,google-maps,google-maps-api-3,Google Maps,Google Maps Api 3,我可以用下面的代码找到附近的医院 private String getUrl(double latitude, double longitude, String nearbyPlace) { StringBuilder googlePlacesUrl = new StringBuilder("https://maps.googleapis.com/maps/api/place/nearbysearch/json?"); googlePlacesUrl.append("locat

我可以用下面的代码找到附近的医院

private String getUrl(double latitude, double longitude, String nearbyPlace) {

    StringBuilder googlePlacesUrl = new StringBuilder("https://maps.googleapis.com/maps/api/place/nearbysearch/json?");
    googlePlacesUrl.append("location=" + latitude + "," + longitude);
    googlePlacesUrl.append("&radius=" + PROXIMITY_RADIUS);
    googlePlacesUrl.append("&type=hospital");
    googlePlacesUrl.append("&sensor=true");
    googlePlacesUrl.append("&key=" + "API");
    Log.d("getUrl", googlePlacesUrl.toString());
    return (googlePlacesUrl.toString());
}

Google Neighbor places API不支持血库作为其类型之一…那么有没有办法只获取最近的血库?如果有,请告诉我如何获取…这将对我的项目有很大帮助…

你可以使用关键字代替类型,有些东西没有类型,血库就是其中之一。或者,您可以尝试搜索健康,然后在代码中检查是否有“血库”之类的词。

来源:

如果查看可选参数部分,则有一个名为
关键字
的参数

使用该参数并从
StringBuilder
中删除
type
参数

类型
参数值应为
血库

private String getUrl(double latitude, double longitude, String nearbyPlace) {
    StringBuilder googlePlacesUrl = new StringBuilder("https://maps.googleapis.com/maps/api/place/nearbysearch/json?");
    googlePlacesUrl.append("location=" + latitude + "," + longitude);
    googlePlacesUrl.append("&radius=" + PROXIMITY_RADIUS);
    googlePlacesUrl.append("&keyword=bloodbank");
    googlePlacesUrl.append("&sensor=true");
    googlePlacesUrl.append("&key=" + "API");
    Log.d("getUrl", googlePlacesUrl.toString());
    return (googlePlacesUrl.toString());
}

谷歌并没有为所有可能的地点类型都设置一个类型。如果你不能通过API获得你想要的信息,你必须建立你自己的数据集,或者可能在其他来源中找到数据。谢谢。这很好。googlePlacesUrl.append(“&ketword=blood bank”)。但是血库和关键字not之间不应该有空格ketword@th3pat31欢迎…你的密码帮了我…谢谢。