I'm trying to get a Street View panorama ID from lat/long coordinates, and I've found this query will return a JSON file containing the panoid (such as JMUfE4l0ucICvD4_BaIGsw).
https://cbks0.google.com/cbk?cb_client=apiv3&authuser=0&hl=en&output=polygon&it=1%3A1&rank=closest&ll=30.2983995,35.1334873&radius=50
Just replace the coordinates to whatever you like.
But here's my question: How can I get this to work for something off-road like the Israel trail? When I put in any coordinates from this off-road trail, it always returns an empty JSON file. (For instance, I know 30.7451333,34.8850511 is a panorama, yet it won't return the panoid.) What am I doing wrong? Thanks.
When you're on google maps, looking at your interior panorama. Just click on the flag, to report the panorama. Then you'll see a parameter in the URL called 'panoid' with the panorama ID in it. You can just copy it there.
To find a location using its latitude and longitude on any device, just open Google Maps. On your phone or tablet, start the Google Maps app. On a computer, go to Google Maps in a browser. Then enter the latitude and longitude values in the search field - the same one you would ordinarily use to enter an address.
The URL that you use to get panorama IDs is undocumented feature. The Terms of Service of Google Maps prohibits access to service via such URLs. Have a look at paragraph 10.1 (a) of ToS.
No access to APIs or Content except through the Service. You will not access the Maps API(s) or the Content except through the Service. For example, you must not access map tiles or imagery through interfaces or channels (including undocumented Google interfaces) other than the Maps API(s).
https://developers.google.com/maps/terms#10-license-restrictions
You should use the API which is Street View Image Metadata in your case.
For example to get panorama ID for 30.7451333,34.8850511 you can execute the following query
https://maps.googleapis.com/maps/api/streetview/metadata?location=30.7451333%2C34.8850511&key=API_KEY
This request returns the following response
{
"copyright":"© 2017 Google",
"date":"2015-05",
"location":{
"lat":30.74513326023706,
"lng":34.88505109084099
},
"pano_id":"Ig2uuF7itfCs8ksgjlJaTQ",
"status":"OK"
}
Now you have a panorama ID Ig2uuF7itfCs8ksgjlJaTQ. Let use it with Street View API:
<img src="https://maps.googleapis.com/maps/api/streetview?pano=Ig2uuF7itfCs8ksgjlJaTQ&size=600x400" title="" />
Hope it helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With