Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

kally1369

macrumors newbie
Original poster
Apr 29, 2010
1
0
Hi,

I'm trying to do application that launches google maps. I'm using MKMapView and CLLocationManager to receive events.
My objective is to display the initial map in a smaller region. Now I'm displaying all the continents in the world:) but I want to display just a small region in radius 10 meters to the user location.

So my code is running, no errors, but I obtain an initial map with all the continents. All I want is displaying smaller region within a certain radius.

Here is my code and thank you for the help:


Code:
- (void)viewDidLoad {
[super viewDidLoad];
map = [[MKMapView alloc]initWithFrame:self.view.bounds];
map.delegate = self;
[self.view insertSubview:map atIndex:0];
 
CLLocationManager *locationManager = [[CLLocationManager alloc]init];
locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;//setting the desired accuracy
locationManager.distanceFilter = 100.0f;
locationManager.delegate = self; // Set the delegate to handle the messages from the location manager
//verifying if gps supported
if (locationManager.headingAvailable) {
[locationManager startUpdatingLocation];
}
 
}
 
 
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
 
 
MKCoordinateRegion coordinateRegion;
coordinateRegion.center = newLocation.coordinate;
coordinateRegion.span.latitudeDelta = 0.005; //set zoom level
coordinateRegion.span.longitudeDelta = 0.005;
 
[map setRegion:region animated:TRUE];
 
}
 
Hmm, 10 meters (~33ft for you imperialists) is an awfully small radius. Google Maps probably won't provide any map image data at that scale.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.