如何向viewRegion.span.latitudeDelta添加2英里?我该如何计算kTwoMiles?
MKCoordinateRegion viewRegion;
viewRegion.center = coordinateCentre;
viewRegion.span.latitudeDelta = latitudeMax - latitudeMin + kTwoMiles;
viewRegion.span.longitudeDelta = longitudeMax - longitudeMin + kTwoMiles;
MKCoordinateRegion adjustedRegion = [mapView regionThatFits:viewRegion];
[mapView setRegion:adjustedRegion animated:YES];
答案 0 :(得分:0)
基本上这是相对复杂的,因为每个学位都有不同的三角形 在地球赤道,你将有每度111公里和0公里的极点。 (http://en.wikipedia.org/wiki/Longitude#Degree_length)
答案 1 :(得分:0)
我决定只在纬度德尔塔增加2英里。可能是regionFhatFits将调整经度Delta的大小。
double kTwoMiles = (double)2/69;
MKCoordinateRegion viewRegion;
viewRegion.center = coordinateCentre;
viewRegion.span.latitudeDelta = latitudeMax - latitudeMin + kTwoMiles;
viewRegion.span.longitudeDelta = longitudeMax - longitudeMin;
MKCoordinateRegion adjustedRegion = [mapView regionThatFits:viewRegion];
[mapView setRegion:adjustedRegion animated:YES];`enter code here`