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.
Go to Google Maps and type in the address you'd like to view. In the lower right hand corner, you'll see the Street View icon. Select the icon and place it where you'd like to snap a 360 image within the map. Once, you set it down, you will see the 360 view.
I think you are missing
[panoramaView_ moveToPanoramaID:@"i3XJvXkmgNMAAAQW-ezYnQ"];
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 completionpanoramaView:didMoveToPanorama:
will be sent toGMSPanoramaViewDelegate
. On errorpanoramaView:error:onMoveToPanoramaID:
will be sent. Repeated calls tomoveToPanoramaID:
result in the previous pending (incomplete) transitions being cancelled -- only the most recent ofmoveNearCoordinate:
andmoveToPanoramaId:
will proceed and generate events. OnlypanoramaID
s 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With