title: Detect Google Static StreetView API Imagery availability
body: <p>I know there are at least a couple of questions like this</p>
  
  <p><a href="https://stackoverflow.com/questions/7839746/detecting-we-have-no-imagery-of-google-maps-street-view-static-images">detecting &quot;we have no imagery&quot; of google maps street view static images</a></p>
  
  <p><a href="https://stackoverflow.com/questions/9795533/how-can-i-tell-if-googles-streetview-image-api-returns-sorry-we-have-no-image">How can I tell if Google&#39;s Streetview Image API Returns &quot;Sorry, we have no imagery here&quot; (ie. NULL) Result?</a></p>
  
  <p>These articles offer a couple of solutions.  The two most popular I've seen here and via Google searaches are:</p>
  
  <ol>
  <li>Detecting the size of the image to determine if you got a "good" image or not from the google static image API</li>
  <li>Call the getPanoramaByLocation service to determine if streetview is available for a location</li>
  </ol>
  
  <p>Unfortunately, I don't want to use the first solution because it feels like the hack, and the second solution does not always seem to work.</p>
  
  <pre><code>  var center = new google.maps.LatLng(latitude, longitude);
    var streetViewService = new google.maps.StreetViewService();
    var maxDistanceFromCenter = 75; //meters
    streetViewService.getPanoramaByLocation(center, maxDistanceFromCenter, function (streetViewPanoramaData, status) {
        if (status === google.maps.StreetViewStatus.OK) {
          var key = /**smarty** #mapKey# **smarty**/;
          var url = 'http://maps.googleapis.com/maps/api/streetview?size=320x320&amp;location=' + latitude + ',%20' + longitude + '&amp;sensor=false&amp;key=' + key;
          jQuery('.ui-page-active .streetView').attr('src', url);
        } else {
          console.log('error calling street view');
        }
    });
  };
  </code></pre>
  
  <p>This code will correctly determine if panoramic imagery is available for a location, BUT sometimes static imagery is not available for that exact same location.</p>
  
  <p>I started at 100 for my getPanoramaByLocation radius and that seemed like a safe number, but then I found a case where I was getting the "Sorry, we have no imagery here" error.  So I went to 75, now I have to go to 50.</p>
  
  <p>It seems like getPanoramaByLocation is not a safe indicator of static streetview imagery being available, or maybe it is but there's a particular value for the radius that should be used.  I can't find it in the docs though.  So my question: what's the safest radius to use for my maxDistanceFromCenter?</p>