#54 Only make street view requests once

master
Keith Irwin 2017-04-18 00:21:21 -04:00
parent 91962dc257
commit 86802b66d5
No known key found for this signature in database
GPG Key ID: 378933C743E2BBC0
1 changed files with 1 additions and 3 deletions

View File

@ -201,9 +201,7 @@ function getAltitude(loc,elev,cb){
function getStreetViewData(loc,rad,cb) {
if (!sv) { var sv=new google.maps.StreetViewService(); }
sv.getPanorama({location:{lat:loc.lat,lng:loc.lon},radius:rad},function(data,status){
if (status===google.maps.StreetViewStatus.ZERO_RESULTS){
getStreetViewData(loc,rad*2,cb);
} else if (status!==google.maps.StreetViewStatus.OK){ console.error(new Error('⛔️ Street view not available:',status).message); }
if (status!==google.maps.StreetViewStatus.OK){ console.error(new Error('⛔️ Street view not available:',status).message); }
else { cb(data); }
});
}