Getting position (latlng) of streetview panorama ID in Google Maps API V3

Hello everybody

With the method “getLinks()” in streetview I can get linked streets of the current panorama. The data includes streetname, direction and panorama IDs of the next panoramas. But I need the position latlng. How can I get the position to these IDs?. I want to calculate all distances to next panoramas. Calculation is no problem.

Thanks.

getLinks is a part of the Street View section of the API.

To get the lat and long, you’ll want to go out further to the standard Geocoding part of things. When you move in Street View, you also move in terms of the whole map.

Hi pmw57,

thanks but that’s clear. What I mean is: getLinks() gives me the next streetnames and other data but not position of next panoramas, only IDs. To calculate distances I must have the positions (latLng).

Possible solution: Jump in a second streetview-object to all IDs (usually 2-4) and get so each latLng by getPosition().

PS: Oh, NZ. I love your country and the kiwi-people :wink:

The following info from that page may be of some use for you:

[indent]Note: do not directly set a position on the StreetViewPanorama when you wish to display custom panoramas, as such a position will instruct the Street View service to request the default Street View imagery close to that location. Instead, set this position within the custom StreetViewPanoramaData’s location.latLng field.

The following example displays a custom Panorama of the Google Sydney office. Note that we don’t use a map (or default StreetView imagery) here at all:
[/indent]

etc…

I’ve got it!


var sv = new google.maps.StreetViewService();
sv.getPanoramaById(inputID, processSVData);
...
function processSVData(data, status) {
...
  alert(data.location.latLng);
...
}