Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why do some panos fail? #4

Closed
mhulse opened this issue Jul 26, 2017 · 8 comments
Closed

Why do some panos fail? #4

mhulse opened this issue Jul 26, 2017 · 8 comments
Milestone

Comments

@mhulse
Copy link
Owner

mhulse commented Jul 26, 2017

Can we stop the process if the image does fail?

Maybe regenerate another?

@mhulse
Copy link
Owner Author

mhulse commented Jul 26, 2017

Good test:

$ npm run esv -- "9.74885,-63.15585550000003" --zoom max > ./foo.png

https://www.instantstreetview.com/@9.74885,-63.155856,342.85h,-16.01p,1z

@mhulse
Copy link
Owner Author

mhulse commented Jul 26, 2017

$ npm run esv -- "CAoSLEFGMVFpcE9ZUE5CQ3phaTFfeTd6dDFpR3RuTlJpY3lPV3VrSnEwdS0yRl9J" --id --zoom max > ./foo.png
Error: could not find street view by id: CAoSLEFGMVFpcE9ZUE5CQ3phaTFfeTd6dDFpR3RuTlJpY3lPV3VrSnEwdS0yRl9J
    at handleResponse (/Users/mhulse/dev/github/mhulse/random-street-coords/node_modules/google-panorama-by-id/browser.js:38:10)
    at Q3 (https://maps.googleapis.com/maps-api-v3/api/js/27/14/streetview.js:68:394)
    at .En (https://maps.googleapis.com/maps-api-v3/api/js/27/14/common.js:39:135)
    at Object.c [as _ffozth] (https://maps.googleapis.com/maps-api-v3/api/js/27/14/common.js:49:404)
    at https://maps.googleapis.com/maps/api/js/GeoPhotoService.GetMetadata?pb=!1m5!1sapiv3!5sUS!11m2!1m1!1b0!2m2!1sen!2sUS!3m3!1m2!1e2!2sCAoSLEFGMVFpcE9ZUE5CQ3phaTFfeTd6dDFpR3RuTlJpY3lPV3VrSnEwdS0yRl9J!4m10!1e1!1e2!1e3!1e4!1e8!1e6!5m1!1e2!6m1!1e2&callback=_xdc_._ffozth:1:28

Get panorama id from here: https://istreetview.com/CAoSLEFGMVFpcE9ZUE5CQ3phaTFfeTd6dDFpR3RuTlJpY3lPV3VrSnEwdS0yRl9J

@mhulse
Copy link
Owner Author

mhulse commented Jul 26, 2017

Pano exists.

Thinking I need to just dissect the extract streetview module and get the code I need.

@mhulse
Copy link
Owner Author

mhulse commented Jul 27, 2017

Use this code:

https://github.com/mattdesl/google-panorama-equirectangular/tree/master/lib

And use browserify to pass pano.tiles to the above code; get images.

Next, create equirectangular.

@mhulse
Copy link
Owner Author

mhulse commented Jul 28, 2017

After researching this some more, it looks like custom panos are hard to predict in terms of URL as they contain some sort of USER id.

I think the best option will be to figure out how to exclude custom panos from my primary Google maps script.

mattdesl/google-panorama-equirectangular#9

@mhulse
Copy link
Owner Author

mhulse commented Jul 31, 2017

Here's an alternative/simpler way of getting rand lat/lon:

<script src="https://maps.googleapis.com/maps/api/js?v=3&key=xxxxxx"></script>
<script>
function TryRandomLocation(callback) {
  //var lat = (Math.random() * 90) - 90;
  var lat = Math.random() * Math.max((180 - 0 * .25), 120) - (90 - Math.min(0 * .25, 45));
  var lng = Math.random() * 360 - 180;
  var sv = new google.maps.StreetViewService();

  // Try to find a panorama within 50 metres 
  sv.getPanorama({
      location: new google.maps.LatLng(lat, lng),
      radius: 50
  }, callback);
}

function HandleCallback(data, status) {
    if (status == 'OK') {
      // Call your code to display the panorama here.
      console.log(data)
    } else {
		console.log('Trying again')
      // Nothing here! Let's try another location.
      TryRandomLocation(HandleCallback);
    }
}

window.onload = function() {
  TryRandomLocation(HandleCallback);
}
</script>

https://stackoverflow.com/a/44478605/922323

Might need to rethink my approach.

Some have suggested working with bounds of a country as the earth has a lot of ocean.

@mhulse
Copy link
Owner Author

mhulse commented Jul 31, 2017

Going to just throw in check for copyright; if it's copyright Google, I'm going to assume streetview will work with the extensions I'm using.

@mhulse
Copy link
Owner Author

mhulse commented Aug 1, 2017

Just added in a conditional that checks the copyright. Works well enough for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant