Search code examples
iosgoogle-mapsgoogle-street-view

GMSPanoramaService requestPanoramaNearCoordinate no result


Trying to request Google Panorama for a coordinate along with a specified radius. Is there any way to get maximum supported radius for a coordinate ? Just not sure what radius I can put into requestPanoramaNearCoordinate, because even if I put 10000 (meters) it does not return any panorama (blank grey screen) where there are in fact panoramas within 50meters.

The requestPanoramaNearCoordinate:

[panoSvc requestPanoramaNearCoordinate:self.coordinate radius:1000 callback:^(GMSPanorama *panorama, NSError *error) {
    if (error) {
        NSLog(@"StreetView is not available at latlong = %f,%f", self.coordinate.latitude, self.coordinate.longitude);
        return;
    }
    else{
        GMSMarker *marker = [GMSMarker markerWithPosition:self.coordinate];
        marker.panoramaView = panoView_;
        [panoView_ moveNearCoordinate:self.coordinate];
    }
}];

Solution

  • So the panoramaView should be moved to panorama.coordinate, not to where the destination coordinate is (which is self.coordinate and where the marker is), see the code following the comment below.

    [panoSvc requestPanoramaNearCoordinate:self.coordinate radius:1000 callback:^(GMSPanorama *panorama, NSError *error) {
    if (error) {
        NSLog(@"StreetView is not available at latlong = %f,%f", self.coordinate.latitude, self.coordinate.longitude);
        return;
    }
    else{
        GMSMarker *marker = [GMSMarker markerWithPosition:self.coordinate];
        marker.panoramaView = panoView_;
        //------------------
        //so I should move panoramaView to panorama coordinate, not to where the destination coordinate is (which is self.coordinate and where the marker is)
        //------------------
        [panoView_ moveNearCoordinate:panorama.coordinate];
    }
    

    }];