Thursday, July 1, 2010

Google Street View availability validation

Hi,

Yesterday, i was working on street view google maps api, i faced an issue on validating some addresses as well as some latitude longitude data for street view. As street view is avaiable only for some locations, some addresses were showing as blank on street view. I managed to validate that via code mentioned below.

function showStreetViewGoogleMaps()
{



 var svClient = new GStreetviewClient();

        svClient.getNearestPanoramaLatLng(point, function (nearest) {
          if ((nearest !== null) && (point.distanceFrom(nearest) <= 100)) {
             alert('Street view available');
          }
          else {
             alert('Street view not available');        // Not within 100 meters
          }
       });


}

This is how i managed to validate street view for google maps.

Cheers!!!

Ujjwal Soni