SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Aug 2010
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    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.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Member
    Join Date
    Aug 2010
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    The following info from that page may be of some use for you:

    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:

    etc...
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Member
    Join Date
    Aug 2010
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow

    I've got it!

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


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •