-1

This code will displace a marker 100 pixels lower down on the screen:

CGPoint point = [myMapView.projection pointForCoordinate:marker.position];
point.y -= 100.0f;
GMSCameraUpdate *camera = [GMSCameraUpdate setTarget:[myMapView.projection coordinateForPoint:point]];
[myMapView animateWithCameraUpdate:camera];

I'd also like to zoom in at the same time. Can anyone help with offseting and zooming in the same animation - that is zooming around a displaced (non-centre) point on the screen. Thanks in advance.

Peter
  • 921
  • 1
  • 10
  • 19

2 Answers2

0

Instead use bellow code for zoomin mapview

 GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:@"12.234"
                                                        longitude:@"77.534"
                                                             zoom:15];
Siva Sankar
  • 523
  • 1
  • 4
  • 18
  • 1
    This moves the centre of the map to coordinate 12.234, 77.534 and then zooms based on that. I need to zoom based on a non-centre or offset point on the screen. – Peter Jun 29 '17 at 14:37
0

I finally managed to do this by setting the GSMapView padding parameter, thereby offsetting the map's centre before doing the camera zoom.

Peter
  • 921
  • 1
  • 10
  • 19