views:

338

answers:

2

I checked the properties in documentation for MKCoordinateRegion, MKCoordinateSpan and MKMapView to see there is a way to get the TopLeft and BottomRight Lat Long from the map view and I didn't find any. I know that the span gives me the Lat long delta but is there a way to get the actual TopLeft and BottomRight lat longs from map view without having to do weird calculations?

I found this http://stackoverflow.com/questions/1831634/how-to-get-left-top-and-right-buttom-latitude-and-longitude-of-map-in-mapkit

Not sure if that is accurate enough. Any votes for that?

+1  A: 

I don't think these calculations qualify as weird:

CLLocationCoordinate2D center = region.center;
CLLocationCoordinate2D northWestCorner, southEastCorner;
northWestCorner.latitude  = center.latitude  - (region.span.latitudeDelta  / 2.0);
northWestCorner.longitude = center.longitude + (region.span.longitudeDelta / 2.0);
southEastCorner.latitude  = center.latitude  + (region.span.latitudeDelta  / 2.0);
southEastCorner.longitude = center.longitude - (region.span.longitudeDelta / 2.0);
Ole Begemann
A: 

Are you sure you got the +- right? I did not get useful results with that. When I switched the +-, I did. Might be my code is flawed somewhere else, though ;)

Longitude is given as an angular measurement ranging from 0° at the Prime Meridian to +180° eastward and −180° westward. The Greek letter λ (lambda),[3][4] is used to denote the location of a place on Earth east or west of the Prime Meridian.

Technically, latitude is an angular measurement in degrees (marked with °) ranging from 0° at the equator (low latitude) to 90° at the poles (90° N or +90° for the North Pole and 90° S or −90° for the South Pole).

(Wikipedia)

Joseph Tura