Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get current zoom level from google map for ios?

Tags:

I use method camera with digital value like this:

camera = [GMSCameraPosition cameraWithLatitude:37.35 longitude:-122.0 zoom:6]; 

and I need automatically redraw map with current position via timer:

-(void)gmapRedraw{     NSLog(@"gmapRedraw"); //    self.MapView.camera     [locationManager startUpdatingLocation];     NSLog(@"lat %f, lon %f", locationManager.location.coordinate.latitude, locationManager.location.coordinate.longitude);     camera = [GMSCameraPosition cameraWithLatitude:locationManager.location.coordinate.latitude//37.36//-37.81319//-33.86                                          longitude:locationManager.location.coordinate.longitude//-122.0//144.96298//151.20                                               zoom:6];     self.MapView.camera = camera; }  -(void)timer{     [NSTimer scheduledTimerWithTimeInterval:0.5                                      target:self                                    selector:@selector(gmapRedraw)                                    userInfo:nil                                     repeats:YES]; } 

but how I can get current zoom if I change it via touch?

like image 759
strx86 Avatar asked Jul 31 '13 14:07

strx86


People also ask

How do I check the zoom level on Google Maps?

You can change the zoom level of the map using simple steps. Step 1 Go to Add or Edit Map page . Step 2 Select 'Default zoom level' in the 'Map Information section'. Step 3 click save map and see the changes.

Can you zoom in on Google Maps?

You can zoom in and out of the map with one hand. Double tap a spot on the map, and then: Drag down to zoom in. Drag up to zoom out.

How do I change the zoom level on Google Maps?

Users can zoom the map by clicking the zoom controls. They can also zoom and pan by using two-finger movements on the map for touchscreen devices.

How do you get zoom level in Mkmapview?

The easiest way to get an Integer of the current zoom level, is by using the MapView function: regionDidChangeAnimated. This function recognizes every change in zoom and will give you the basis for the calculation of the zoom factor.


1 Answers

OK, I find solution, get current zoom:

CGFloat currentZoom = self.MapView.camera.zoom; 

and then use it in camera:

camera = [GMSCameraPosition cameraWithLatitude:locationManager.location.coordinate.latitude                                      longitude:locationManager.location.coordinate.longitude                                           zoom:currentZoom]; self.MapView.camera = camera; 
like image 128
strx86 Avatar answered Sep 28 '22 05:09

strx86