KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Whenever the user zoom in or out the map i need to know how many meters are currently represented on the map (width or height). What i need is the inverse function of MKCoordinateRegionMakeWithDistance to calculate the distance represented by the current map span. I tried the following code but i get wrong results : - (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated { MKMapRect mRect = self.map.visibleMapRect; MKMapPoint northMapPoint = MKMapPointMake(MKMapRectGetMidX(mRect), MKMapRectGetMinY(mRect)); MKMapPoint southMapPoint = MKMapPointMake(MKMapRectGetMidX(mRect), MKMapRectGetMaxY(mRect)); self.currentDist = MKMetersBetweenMapPoints(northMapPoint, southMapPoint); } If i set the map region to 1500 meters i get something like 1800 as a result.. Thanks for your help, Vincent
Tags (comma-separated)
Save Edits
Cancel