How to set the correct header for the Google Maps JavaScript API version 3 in case of a mailing address?

I am struggling with the following problem and cannot find any solution in Goolge Maps API Docs or on the web, so I will try to post my question here:

I used the Googles Static StreetView Image API, where you can pass a long / lat or a string with a mailing address as the location. In my case, I always used the string approach, which in most cases contains the address with the number number. I was amazed at the results of the returned image, which in most cases was ideally oriented towards the desired address.

Now I wanted to try the JavaScript API for StreetViews. It works great with the only interface available for location, defining the address through long / lat values. Optional pov parameters can also include a header. But if you want to initialize StreetView with a postal address with a number number, you will lose this API. The only way is to bind the mailing address to a long / latin value through the geocoding API, but with a handicap of losing header information. As a final result, the initial StreetView image was completely different, oriented in that case.

I checked the Static StreetView Image API again and found the following header comment:

caption (optional): ... If no caption is specified, a value will be calculated that directs the camera to the specified location, starting from the point where the closest photograph was taken.

Is there anything I can do here? How can I find the perfect caption between the position of the photo taken in the place I'm looking for? It seems that only Google can do this through some internal magic for the Static StreetView Image API.

+5
source share
1 answer

1) Indeed, geocode the mailing address to long / lat, so you have the "exact" location of the house.

2) streetViewService.getPanoramaByLocation, , , , .

(1 - "", 2 - "" ). google.maps.geometry.spherical.computeHeading - . https://developers.google.com/maps/documentation/javascript/geometry#Navigation

+5

All Articles