Saturday, 15 January 2011

ios - How to get radius from visible area of MKmapview? -


I am able to get the visual rectangle of the map view and the center point and duration of the map view deltas also comes from mkmaap view The methods are: To see: mapView.visibleMapRect is used to get the center point: see the map. Nucleus coordination is used and to get the duration: mapView.region.span is used.

Now all the information I have, how can I calculate the radius of the calculation? Can anyone explain me in detail?

I have seen but the answer is not giving the radius of the area visible to me.

Radius to follow this:

  - (CLLocationDistance GetRadius {CLLocationCoordinate2D Centrotech = [self getCenterCoordinate]; // Center location coordination from center center CLLocation * centerLocation = [[CLLocation alloc] initWithLatitude: centerCoor.latitude longitude: centerCoor.longitude]; CLLocationCoordinate2D topCenterCoor = [auto matching center center]; CLLocation * topCenterLocation = [[CLLocation alloc] initWithLatitude: topCenterCoor.latitude longitude: topCenterCoor.longitude]; CLLocationDistance radius = [location from center location distance: top center position]; Return radius; }  

This will return the radius to meters .

To get center coordination

  - getCenterCoordinate {CLLocationCoordinate2D} {returns [self.mapView centerCoordinate]; }  

To get the radius, it depends on where you want to take 2 points. To get coordination with the CGPO of your map returns, move Top Center

  - getTopCenterCoordinate {//} [self.mapView Convert page: CGPointMake ( Self.mapView) .frame.size.width / 2.0f, 0) toCoordinateFromView: self.mapView]; }  

No comments:

Post a Comment