4

Google Places API の近くの検索を使用して、複数の特定の場所を取得したいと考えています。NAME パラメーターを使用して複数の場所を照会するための形式は何ですか。API は、単一の場所について次のように表示します。

     https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=harbour&sensor=false&key=AddYourOwnKeyHere

| を追加することで複数のタイプを指定できるというドキュメントを読みました。.

Google Place API Nearby 検索で複数の名前パラメータを指定するにはどうすればよいですか?

4

2 に答える 2

0

検索に複数のタイプを使用する場合は、ビットごとの OR 演算子を使用できます。3 つの異なるタイプを使用した append の最後の行を参照してください。ここに例があります

private String getUrl(){

    StringBuilder sb = new StringBuilder("https://maps.googleapis.com/maps/api/place/nearbysearch/json?");
    if(mLastLocation != null){
        sb.append("location=" + mLastLocation.getLatitude() + "," + mLastLocation.getLongitude());
    }
    sb.append("&radius=" + searchWithin);
    sb.append("&sensor=true");
    sb.append("&key=" + getString(R.string.map_api_key));
    sb.append("&types=" + "restaurant|atm|bank");

    return sb.toString();
}
于 2017-05-29T10:43:28.767 に答える
-1

リクエスト変数の「name」フィールドに別の名前を指定する必要があります。| で区切ります。と引用符で囲みます。

var request = {
  location: new google.maps.LatLng(-33.8665433,151.1956316),
  radius: '500',
  name: "name1|name2|name3",
  types: ['store']
};

service = new google.maps.places.PlacesService(map);
service.nearbySearch(request, callback);

https://developers.google.com/maps/documentation/javascript/places#place_search_requests

于 2013-12-13T22:54:27.457 に答える