开发者

rational zoom level

开发者 https://www.devze.com 2023-02-24 20:41 出处:网络
my code for MapKit is that : MKCoordinateRegion region; region.center = location; MKCoordinateSpan span;

my code for MapKit is that :

MKCoordinateRegion region;
    region.center = location;
    MKCoordinateSpan span;
    span.latitudeDelta = .005;
    span.longitudeDelta = .005;
    region.span = span;
    [mapView setRegion:region animated:TRUE];

the span level is .005开发者_JAVA百科 , when i test this on iPhone the zoom is very high which is not practical, i want a reasonable zoom level, so what value should i give to span ?? thx in advance :)


The span values are in degrees. The docs for MKCoordinateSpan explain what that translates to in miles/kilometers. A larger span means a greater area is visible.

For example, 0.01 is about 1 km if the latitude is near the equator. 1.00 is about 111 km at the equator. 0.005 is about half km at the equator. What's "reasonable" depends on your app's requirements.

A value of 0.01 shows a view approximately from the Eiffel Tower to the Boucicaut Hospital.

0

精彩评论

暂无评论...
验证码 换一张
取 消