javascript - Request main road / curbside StreetView panoramas instead of back alleys from API -


is there way request main road google streetview panorama data instead of alley panorama data given location (latitude/longitude)?

i'm using google maps javascript api retrieve street view panorama home address supplied our users. works quite addresses i've tried, i'm noticing lot of properties in california have street views alleys, , api seams consistently returning alley panorama instead of main road (front of property) panorama.

i don't want show user alley panorama of home, instead main road panorama. if lookup same address on maps.google.com see front of house, when request same address through api alley.

the process i'm using is:

  1. geocode address
  2. get panorama given geocode location (lat/long)
  3. compute heading , display panorama on page

test addresses:

  1. 325 s peck dr, beverly hills, ca, usa, 90212
  2. 333 s rodeo dr, beverly hills, ca, usa, 90212

any ideas or suggestions appreciated. thanks!

use directions service directions desired address itself. use location instead of geocoder result street view location. use geocoder result (hopefully rooftop accuracy result) place "at".

related question: facing targeted building google streetview examples:

code snippet:

var sv = new google.maps.streetviewservice();  var geocoder = new google.maps.geocoder();  var directionsservice = new google.maps.directionsservice();  var panorama;  var address = "333 s rodeo dr, beverly hills, ca, usa, 90212";  var mylatlng;    function initialize() {      panorama = new google.maps.streetviewpanorama(document.getelementbyid("pano"));      geocoder.geocode({      'address': address    }, function(results, status) {      if (status == google.maps.geocoderstatus.ok) {        mylatlng = results[0].geometry.location;          // find streetview location on road        var request = {          origin: address,          destination: address,          travelmode: google.maps.directionstravelmode.driving        };        directionsservice.route(request, directionscallback);      } else {        alert("geocode not successful following reason: " + status);      }    });  }  google.maps.event.adddomlistener(window, 'load', initialize);    function processsvdata(data, status) {    if (status == google.maps.streetviewstatus.ok) {        panorama.setpano(data.location.pano);        var heading = google.maps.geometry.spherical.computeheading(data.location.latlng, mylatlng);      panorama.setpov({        heading: heading,        pitch: 0,        zoom: 1      });      panorama.setvisible(true);      } else {      alert("street view data not found location.");    }  }    function directionscallback(response, status) {    if (status == google.maps.directionsstatus.ok) {      var latlng = response.routes[0].legs[0].start_location;      sv.getpanoramabylocation(latlng, 50, processsvdata);    } else {      alert("directions service not successfull following reason:" + status);    }  }
<script src="https://maps.googleapis.com/maps/api/js?libraries=geometry"></script>  <div id="pano" style="width: 425px; height: 400px;float:left"></div>


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -