2015-04-16 11 views
6

Ich verwende Google Places Photos Api und möchte Bilder für ausgewählte Städte nach Placid oder Stadttitel anzeigen.So erhalten Sie Städteansichten von Google Places API

Ich versuche, zwei Methoden:

1. F. E. Ich schicke Anfrage (gebraucht London placeid)

https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJdd4hrwug2EcRmSrV3Vo6llI&key=API_KEY 

get Lage von Antwort

"lat": 51.5073509 
"lng": -0.1277583 

nächster Schritt Anfrage

https://maps.googleapis.com/maps/api/place/radarsearch/json?location=51.5073509,-0.1277583&radius=5000&types=park|church|cafe|food|bar|night_club|stadium|store&keyword=&key=API_KEY 

Antwort enthält viele Objekte mit placeid ist, dass ich für neue verwenden Anfrage wie zuerst

https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJ1eu1vwgIdkgRwjsifpZERQc&key=API_KEY 

Antwort enthalten photo_reference Objekt, das der Teil meines Bildquelle ist

https://maps.googleapis.com/maps/api/place/photo?photoreference=CoQBcwAAAMLCk4X_WMliqIfISe-mgxRadycuzApodVcaCrTMGP6wQXJaquATedXMkvnjuLAfTG9xzBYQfSNm3iXV07wxHr_X_WDhfjz_yQjmqCYlKwYwK5hH-nl9qi-4ZZqKKtFuphFEY8ka25GYN2sTNMdd0v99j7YCzpR-lHJnl0zA9QoPEhBA5CnCgElBAU7Z92VTShg2GhQUes4fTRKiJlW6rYKYEaNilauWaA&key=API_KEY&maxwidth=1200 

result image

Es ist nicht das beste Foto von London ...

2. mit param Abfrage = TEXTSUCHE Sehenswertes + in + London

https://maps.googleapis.com/maps/api/place/textsearch/json?query=sights+in+London&key=API_KEY 

Diese Anfrage return respo nse, die photo_reference Objekte enthält. schließlich Anfrage ist

https://maps.googleapis.com/maps/api/place/photo?photoreference=CnRnAAAAlLsg47UJRPVLdM8_sUbeLSia70EJ_mTisVDfCDTVUYNXl-35BGqzRARtq-Lt1CNcBWy3sKigfBVuF0iCr9-xqp1khK2l5JV3806LKvZrHJCaONYW35UBxxIIwxvxV-df4I4hg6f_zgeeIkWXGSYQhhIQNGYJl0fvHb3HslymbhH1thoUdLhGe8rJVCnyl_y0xAagzkFWs-Y&key=API_KEY&maxwidth=1200 

result image

Wie kann ich Bilder wie these

+0

Flicker und Panoramio API sind großartig, um Fotos von jedem Ort zu bekommen. – ihimv

Antwort

1

erhalten Die Places API direkt jetzt ein paar Fotos für Städte wie London zurück. Zum Beispiel Ihre Anfrage nach London durch Platz ID:

https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJdd4hrwug2EcRmSrV3Vo6llI&key=API_KEY 

Inklusive this photo of the Place of Westminster, die auch auf Google Maps angezeigt wird.

Verwandte Themen