Question

Does the span for MKCoordinateRegion represent the distance from the center to each boundary or the distance from boundary to boundary?

If I want to calculate the boundaries of the region to I add/subtract the span from the center or do I need to /2?

lowerLatitude=center-span.latitudeDelta or lowerLatitude=center-(span.latitudeDelta/2)

Was it helpful?

Solution

Running this code:

self.mapView.region = MKCoordinateRegionMake(CLLocationCoordinate2DMake(0.0, 0.0), MKCoordinateSpanMake(23.5, 10.0));

I was able to see as far north as the border of the Western Sahara, and as far south as the Etosha National Park; as far west as the west cosast of Senegal; and as far east as N'Djamena.

Based on that, and a little time with Google Maps, it appears that the span is a total of 47 degrees north-south, and 20 degrees west-east.

OTHER TIPS

The span is the distance from boundary to boundary. If the most Westerly place you can see is at 10 degrees and the most Eastery is 20 degrees, the longitudeDelta will be 10 degrees (span). The center coordinate will have a longitude of 15 degrees (a point, not a span).

To put it another way, the span is twice the distance from the center to the edge. The center is the point half way along both spans.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top