Question

I want to show this location inside the map with out using Google Maps URL Scheme.I used GMSPanoramaView for showing street view by using given lat/long (53.426398,-2.242795) but inside building area not showing , that area is showing in browser or URL Scheme.

I used github demo code to show street view but I want to show exactly above location inside app.

I dont want to use webview ,safari or google map app.

Was it helpful?

Solution

I think you are missing

[panoramaView_ moveToPanoramaID:@"i3XJvXkmgNMAAAQW-ezYnQ"];

OTHER TIPS

It's possible! Extract the panoid from user2744623's post:

Here's an alternate link (used Embedder for Google Business View) https://maps.google.com/maps?layer=c&panoid=shcQTg4Y9qh9T0p5aspVvA&ie=UTF8&source=embed&output=svembed&cbp=13%2C213%2C%2C0%2C0

And then use it as a PanoramaID in the iOS SDK:

GMSPanoramaView *view_ = [GMSPanoramaView panoramaWithFrame:CGRectZero
                          nearCoordinate:CLLocationCoordinate2DMake(53.426398, -2.242795)];
[view_ moveToPanoramaID:@"shcQTg4Y9qh9T0p5aspVvA"];

You can then set GMSPanoramaCamera:cameraWithHeading:pitch:zoom: to whichever angle you prefer:

[GMSPanoramaCamera cameraWithHeading:200.0f pitch:-10.0f zoom:1];

Here's the official documentation on GMSPanoramaView:moveToPanoramaID::

Requests a panorama with panoramaID. Upon successful completion panoramaView:didMoveToPanorama: will be sent to GMSPanoramaViewDelegate. On error panoramaView:error:onMoveToPanoramaID: will be sent. Repeated calls to moveToPanoramaID: result in the previous pending (incomplete) transitions being cancelled -- only the most recent of moveNearCoordinate: and moveToPanoramaId: will proceed and generate events. Only panoramaIDs obtained from the Google Maps SDK for iOS are supported.

I think you can ignore the last sentence, heh.

Here's a complete-ish implementation, adapted from the SDK demo project:

@interface PanoramaViewController () <GMSPanoramaViewDelegate>
@end

@implementation PanoramaViewController {
    GMSPanoramaView *view_;
    BOOL configured_;
}

- (void)viewDidLoad {
    [super viewDidLoad];

    view_ = [GMSPanoramaView panoramaWithFrame:CGRectZero
                                nearCoordinate:CLLocationCoordinate2DMake(53.426398, -2.242795)];
    view_.backgroundColor = [UIColor grayColor];
    view_.delegate = self;
    self.view = view_;

    [view_ moveToPanoramaID:@"shcQTg4Y9qh9T0p5aspVvA"];
}

#pragma mark - GMSPanoramaDelegate

- (void)panoramaView:(GMSPanoramaView *)view
   didMoveToPanorama:(GMSPanorama *)panorama {
    if (!configured_) {
        view_.camera = [GMSPanoramaCamera cameraWithHeading:200.0f pitch:-10.0f zoom:1];

        configured_ = YES;
    }
}

// Use to fine-tune initial heading and pitch
- (void)panoramaView:(GMSPanoramaView *)panoramaView
       didMoveCamera:(GMSPanoramaCamera *)camera {
    NSLog(@"Camera: (%f,%f,%f)", camera.orientation.heading, camera.orientation.pitch, camera.zoom);
}

// Helpful in finding other panorama IDs or debugging:
- (void)panoramaView:(GMSPanoramaView *)view
willMoveToPanoramaID:(NSString *)panoramaID {
    NSLog(@"willMoveToPanoramaID: %@", panoramaID);
}

- (void)panoramaView:(GMSPanoramaView *)view
               error:(NSError *)error
  onMoveToPanoramaID:(NSString *)panoramaID {
    NSLog(@"error: %@ onMoveToPanoramaID: %@", error, panoramaID);
}

@end

You have two options. Download the pano or use one of the many Google approved ways to obtain the view.

Here's an alternate link (used Embedder for Google Business View) https://maps.google.com/maps?layer=c&panoid=shcQTg4Y9qh9T0p5aspVvA&ie=UTF8&source=embed&output=svembed&cbp=13%2C213%2C%2C0%2C0

Grab the pano using Pano Fetch

Use the API - The below is partially psudo code, You'll require a small amount of Javascript knowledge.

var your_pano = new google.maps.LatLng(53.426398,-2.242795);
  var panoramaOptions2 = {
    position: your_pano,
        addressControlOptions: {
      position: google.maps.ControlPosition.TOP_CENTER
    },
    zoomControl: false,
    linksControl: true,
    panControl: false,
    fov: 110,
    pov: {
      heading: 100,
      pitch: -20
    },
    zoom: 0
  };
  var your_pano = new google.maps.StreetViewPanorama(
      document.getElementById('your_pano'),
      panoramaOptions2);
  your_pano.setVisible(true);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top