1

I am using street view API from google maps SDK in my application. Requirement is to show street view with disabling gestures control. I have added this code my application

    GMSPanoramaView *panoView = [[GMSPanoramaView alloc] initWithFrame:CGRectMake(0, 0, _placesView.frame.size.width, _placesView.frame.size.height)];
    [_placesView addSubview:panoView];
    panoView.delegate = self;
    [panoView setAllGesturesEnabled:NO];
    [panoView moveNearCoordinate:addresslocationCoordinates]; 

But the orientation I am getting when street view is presented is different from orientation at the web.

enter image description hereenter image description here

Location here in both the picture is same but they are heading towards different direction.

If I want to align my street view with view at web then what should be done?

Himan Dhawan
  • 894
  • 5
  • 23

1 Answers1

1

You need to set your StreetView point-of-view (POV) in your iPhone app like below :

panoView.camera = GMSPanoramaCamera(heading: 180, pitch: -10, zoom: 1)

so based on above value your street head show on your device.

Orientation

The Street View location defines the placement of the camera focus for an image, but it does not define the orientation of the camera for that image. For that purpose, the GMSOrientation object defines two properties:

heading: defines the rotation angle around the camera locus in degrees relative from true north. Headings are measured clockwise: true north is 0, east is 90, south is 180, west is 270.

pitch: (default 0) defines the angle variance "up" or "down" from the camera's initial default pitch, which is often (but not always) flat horizontal. (For example, an image taken on a hill will likely exhibit a default pitch that is not horizontal.) Pitch angles are measured with positive values looking up (to +90 degrees straight up and orthogonal to the default pitch) and negative values looking down (to -90 degrees straight down and orthogonal to the default pitch).

Hope this will helps to set your Street View head position!

CodeChanger
  • 7,953
  • 5
  • 49
  • 80
  • Even after making it rotate in 180 degree , results on web and mobile end are not same. We want exactly the same street view. – Himan Dhawan Feb 05 '19 at 12:20
  • You need to debug and check what web uses for its head and pitch and based on that you have to set both value on your app side than and than it will look like same as web otherwise it will differ from web street view. – CodeChanger Feb 05 '19 at 12:31