本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
如何從位置搜尋附近的
SearchNearby API 可讓您查詢所有附近的位置和興趣點 (POI),而無需輸入任何特定文字。使用者可以使用此 API 探索鄰里、探索 POIs等。它需要 QueryPosition
,它可以代表裝置的位置、IP 型位置或地圖檢視區中心。或者,使用者可以根據該位置的地理座標,指定要偏差結果的城市或位置。
潛在的使用案例
-
探索附近的 POIs:檢視目前位置附近的所有興趣點。
-
探索附近的位置:檢視指定位置附近的所有位置。
範例
在此範例中,會從緯度 25.26951 和經度 55.30884 的杜拜位置執行搜尋。
- Sample request
-
{ "QueryPosition": [ 55.30884, 25.26951 ] }
- Sample response
-
{ "ResultItems": [ { "PlaceId": "<Redacted>", "PlaceType": "PointOfInterest", "Title": "هما", "Address": { "Label": "هما, شارع مستشفى آل مكتوم, نايف دبي, الإمارات العربية المتحدة", "Country": { "Code2": "AE", "Code3": "ARE", "Name": "الإمارات العربية المتحدة" }, "SubRegion": { "Name": "دبي" }, "Locality": "دبي", "District": "نايف", "Street": "شارع مستشفى آل مكتوم", "StreetComponents": [ { "BaseName": "مستشفى آل مكتوم", "Type": "شارع", "TypePlacement": "BeforeBaseName", "TypeSeparator": " ", "Language": "ar" } ] }, "Position": [ 55.30884, 25.26951 ], "Distance": 0, "Categories": [ { "Id": "department_store", "Name": "Department Store", "LocalizedName": "مول تجاري", "Primary": true } ], "BusinessChains": [ { "Name": "HEMA", "Id": "HEMA" } ] }, { "PlaceId": "<Redacted>", "PlaceType": "Locality", "Title": "دبي, الإمارات العربية المتحدة", "Address": { "Label": "دبي, الإمارات العربية المتحدة", "Country": { "Code2": "AE", "Code3": "ARE", "Name": "الإمارات العربية المتحدة" }, "SubRegion": { "Name": "دبي" }, "Locality": "دبي" }, "Position": [ 55.30884, 25.26951 ], "Distance": 0, "MapView": [ 54.64906, 24.62308, 55.7371, 25.36995 ] } ] }
- cURL
-
curl --request POST \ --url 'https://places.geo.eu-central-1.amazonaws.com/v2/search-nearby?key=Your_Key' \ --header 'Content-Type: application/json' \ --data '{ "QueryPosition": [ 55.30884, 25.26951 ], "MaxResults": 2 }'
- AWS CLI
-
aws geo-places search-nearby --key ${YourKey} \ --query-position 55.30884 25.26951 \ --max-results 2
使用 SearchNearby
根據類別搜尋附近的位置