Places
- URL:
https://maps.googleapis.com/maps/api/place/nearbysearch/output?input=value
- Python:
Client.places_nearby
- 搜尋指定區域內的地點。
Key Input | Option Input | Output Type | Output | Result |
---|---|---|---|---|
keykey | keywordkeyword | xmlxml | statusstatus | name |
locationlocation | languagelanguage | jsonjson | html_attributions | vicinity |
radiusradius | minpriceminprice | next_page_token | type | |
maxpricemaxprice | result | geometry | ||
namename | rating | |||
opennowopennow | icon | |||
rankbyrankby | reference | |||
typestypes | id | |||
pagetokenpagetoken | opening_hours | |||
zagatselectedzagatselected | photo | |||
place_id | ||||
scope |
Python Library
def places_nearby(client, location, radius=None, keyword=None, language=None,min_price=None, max_price=None, name=None, open_now=False,rank_by=None, type=None, page_token=None)
到 Sample code
import googlemaps
client = googlemaps.Client(key='AIzaSyAz1hWEiamCgwsceUYG_dQkvTmfwTBoFT4')
languages = 'zh-TW'
location = (25.1207, 121.5019)
types = 'gas_station'
radius = 500
directions_result = client.places_nearby(location, radius ,language=languages, type=types)
for i in directions_result.get('results'):
print 'rating:',i.get('rating')
print 'name:',i.get('name')
print 'scope:',i.get('scope')
print 'types:',i.get('types')
print 'vicinity:',i.get('vicinity')
print '-------------------------------------'
- URL:
https://maps.googleapis.com/maps/api/place/textsearch/output?input=value
- Python:
Client.places
- 搜尋指定區域內的地點。
Key Input | Option Input | Output Type | Output | Result |
---|---|---|---|---|
keykey | location location | xmlxml | statusstatus | name |
queryquery | languagelanguage | jsonjson | html_attributions | type |
minpriceminprice | next_page_token | formatted_address | ||
maxpricemaxprice | result | geometry | ||
radius radius | rating | |||
opennowopennow | icon | |||
typestypes | reference | |||
pagetokenpagetoken | id | |||
zagatselectedzagatselected | opening_hours | |||
photo | ||||
price_level | ||||
place_id |
Python Library
def places(client, query, location=None, radius=None, language=None,min_price=None, max_price=None, open_now=False, type=None,page_token=None)
Sample code
import googlemaps
client = googlemaps.Client(key='AIzaSyAz1hWEiamCgwsceUYG_dQkvTmfwTBoFT4')
languages = 'zh-TW'
location = (25.1203050, 121.5017983)
types = 'food'
radius = 100
query = 'Subway'
directions_result = client.places(query,location,radius=radius,type=types)
for i in directions_result.get('results'):
print 'rating:',i.get('rating')
print 'name:',i.get('name')
print 'types:',i.get('types')
print 'formatted_address:',i.get('formatted_address')
print '-------------------------------------'
- URL:
https://maps.googleapis.com/maps/api/place/radarsearch/output?input=value
- Python:
Client.places_radar
- 可讓您一次搜尋高達 200 個地點,但是與一般從「文字搜尋」或「附近地點搜尋」要求傳回的資訊相比較不詳細。
Key Input | Option Input | Output Type | Output | Result |
---|---|---|---|---|
keykey | keywordkeyword | xmlxml | statusstatus | id |
locationlocation | namename | jsonjson | html_attributions | place_id |
radiusradius | minpriceminprice | next_page_token | reference | |
maxpricemaxprice | result | geometry | ||
opennowopennow | ||||
typestypes | ||||
zagatselectedzagatselected |
Python Library
def places_radar(client, location, radius, keyword=None, min_price=None, max_price=None, name=None, open_now=False, type=None)
Sample code
import googlemaps
client = googlemaps.Client(key='AIzaSyAz1hWEiamCgwsceUYG_dQkvTmfwTBoFT4')
location = (25.1203050, 121.5017983)
radius = 1000
keyword = 'Subway'
types = 'food'
directions_result = client.places_radar(location,radius,keyword,type=types)
for i in directions_result.get('results'):
print 'geometry:',i.get('geometry')
print 'id:',i.get('id')
print 'place_id:',i.get('place_id')
print 'reference:',i.get('reference')
print '-------------------------------------'
places_autocomplete https://maps.googleapis.com/maps/api/place/autocomplete/output?parameters
places_autocomplete_query https://maps.googleapis.com/maps/api/place/queryautocomplete/output?parameters
https://maps.googleapis.com/maps/api/place/delete/json?key=YOUR_API_KEY
key:Key
:您應用程式的API 金鑰。
location:Location
:用來擷取其周圍地點資訊的緯度/經度。指定 location 參數,就必須一併指定 radius
參數。
radius:Radius
:定義要傳回地點結果的距離範圍 (單位為公尺)。允許的最大半徑是50,000 公尺。請注意,如果已指定 rankby=distance就不得包括 radius。
language:Language
:語言設定,請參閱支援的語言清單。
name:Name
:要與地點的名稱比對的一或多個字詞 (以空格字元分隔)。
minprice:Minprice
:有效值的範圍是 0 (最負擔得起) 到 4 (最昂貴),含 0 和 4。特定值所代表的確切金額將因地區而異。
maxprice:Maxprice
:有效值的範圍是 0 (最負擔得起) 到 4 (最昂貴),含 0 和 4。特定值所代表的確切金額將因地區而異。
rankby:Rankby
:指定列出結果的順序。(prominence |distance
)。
types:Types
:將結果限制在至少與其中一個指定類型相符的地點。類型應該以直立線符號分隔 (type1|type2|etc
)。請參閱支援的類型清單。
pagetoken:Pagetoken
:傳回上次執行之搜尋的接下來 20 個結果。設定 pagetoken 參數將會使用與先前使用的相同參數來執行搜尋,pagetoken 以外的所有參數都將被忽略。