Saturday, July 30, 2016

Link to street view URL using address?

Leave a Comment

Is it possible to link directly to street view from an URL using only the address (and not lat/lng)?

For example, is there a way to do something like

http://maps.google.com/maps?q=&layer=c&address=Street,number,state&cbp=11,0,0,0,0 

Instead of

http://maps.google.com/maps?q=&layer=c&cbll=31.335198,-89.287204&cbp=11,0,0,0,0 

?

Lat/lng from geocoding tends to not be recognized by street view as being too far from a street, sometimes getting the wrong street altogether.

I have looked everywhere and even tried playing with google's URLs on my own, but I can't find anything on it. Most sources won't even mention address. I'm currently using the url sample from this question, but it still isn't really what I'm looking for.

If this is really not possible, could someone link to a source/documentation where it says so?

2 Answers

Answers 1

First reverse geocode to find the lat lng using another Google Service API.

Then feed the resulting lat lng into the streetview endpoint parameter.

Answers 2

Let's enhance your code, if you paste the code in browser then you will be redirect to google maps and will show result what you requested.

http://maps.google.com/maps?&q=Space+Needle,Seattle+WA

If you would like to pass the value (address) via php or any other code type then simply it will not work, you cannot use google maps without API to enhance your requirement. Lat & Lng is basic practice to show map and not require any api, but if you would like to pass additional properties then you will have to use google maps api to do so. Detailed documentation can be found here

https://developers.google.com/maps/documentation/embed/guide

but let's try an example try this code in browser

https://www.google.com/maps/embed/v1/place?q=Mumbai,+Maharashtra,+India

You will get an error that api key not found but if you try this one

https://www.google.com/maps/embed/v1/place?key=AIzaSyD4iE2xVSpkLLOXoyqT-RuPwURN3ddScAI&q=Space+Needle,Seattle+WA

Then you will get output. Hope it helps!

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment