0
-(void) setTheMapViewRegionBasedonCurrentAnchorandDistance
{
    //PD([BNUtilitiesQuick MaxDistanceOnSearch]);
    //self.theMapView.centerCoordinate = [cachedProperties singleton].currentAnchor.coordinate;
    //self.theMapView.region.span.longitudeDelta=[BNUtilitiesQuick MaxDistanceOnSearch]*safetyMarginForMap; 
    double ratio = self.theMapView.frame.size.height/self.theMapView.frame.size.width;
    //double ratio = self.theMapView.visibleMapRect.size.height/self.theMapView.visibleMapRect.size.width;
    PD([BNUtilitiesQuick MaxDistanceOnSearch]);
    double distanceFromEastAndWestShyouldBe = [BNUtilitiesQuick MaxDistanceOnSearch]*ratioBetweenEastWestToDistanceFilter;
    PD(distanceFromEastAndWestShyouldBe);
    self.theMapView.region = MKCoordinateRegionMakeWithDistance([cachedProperties singleton].mapCenterLocation.coordinate,distanceFromEastAndWestShyouldBe, distanceFromEastAndWestShyouldBe);
    PD(self.DistanceBetweenWestandEast);
    PD(ratio);
}

看看那个代码。我将 MKMapview 区域设置为 distanceFromEastAndWestShyouldBe 的数量。输出是:

    2012-08-10 11:30:13.789 BadgerNew[15438:17003] <0x874d0b0 GoogleMap.m:(394)> [BNUtilitiesQuick MaxDistanceOnSearch]: 193.690170
2012-08-10 11:30:13.789 BadgerNew[15438:17003] <0x874d0b0 GoogleMap.m:(396)> distanceFromEastAndWestShyouldBe: 464.856409
2012-08-10 11:30:13.790 BadgerNew[15438:17003] <0x874d0b0 GoogleMap.m:(398)> self.DistanceBetweenWestandEast: 761.369705
2012-08-10 11:30:21.329 BadgerNew[15438:17003] <0x874d0b0 GoogleMap.m:(399)> ratio: 1.437500

基本上我将地图设置为 464 m 宽度,而地图宽度为 761 m。

MKMapview 的高宽比为 1.43。这并不重要,因为我对纬度和经度都使用较小的数字。

在 MKMapview 中计算东西方实际差异的代码是:

-(double)DistanceBetweenWestandEast     
{
    CLLocationDegrees longitudeDelta=self.theMapView.region.span.longitudeDelta;
    double distanceeastwest = longitudeDelta * MetersIn1DegreeofEarth;
    return distanceeastwest;    
}

#define MetersIn1DegreeofEarth 110882.5

在别处定义

解决方法是在更改地图视图区域之前简单地除以 1.6。但是,我想知道为什么它首先关闭。

4

2 回答 2

1

经线之间的距离随纬度而变化。在赤道,经度一度约为 111 公里,但向北或南纬 75 度,经度一度约为 29 公里。您对东西距离的计算假设视图位于赤道上。尝试使用 CLLocation 的 distanceFromLocation 将纬度考虑在内。你需要两分。center-longitudeDelta/2 和 center+longitudeDelta/2

于 2012-08-10T16:33:47.003 回答
0

我发现了问题所在:

我写了这段代码:

  for (int i=100;i<10000;i=i*1.1)
    {
        distanceWereInputing = i;
        self.theMapView.region = MKCoordinateRegionMakeWithDistance([cachedProperties singleton].mapCenterLocation.coordinate,distanceWereInputing, distanceWereInputing);
        PD(distanceWereInputing);
        PD(self.DistanceBetweenWestandEast);
        PD(self.DistanceBetweenWestandEast/distanceWereInputing);
    }

这是结果:

2012-08-10 12:33:33.935 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(394)> [BNUtilitiesQuick MaxDistanceOnSearch]: 193.690170
2012-08-10 12:33:33.935 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(396)> distanceFromEastAndWestShyouldBe: 464.856409
2012-08-10 12:33:50.500 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 100.000000
2012-08-10 12:33:51.740 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 95.171213
2012-08-10 12:33:54.042 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 0.951712
2012-08-10 12:34:02.613 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 110.000000
2012-08-10 12:34:02.613 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 190.342426
2012-08-10 12:34:02.614 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.730386
2012-08-10 12:34:02.614 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 121.000000
2012-08-10 12:34:02.614 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 190.342426
2012-08-10 12:34:02.614 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.573078
2012-08-10 12:34:02.615 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 133.000000
2012-08-10 12:34:02.615 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 190.342426
2012-08-10 12:34:02.615 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.431146
2012-08-10 12:34:02.616 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 146.000000
2012-08-10 12:34:02.620 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 190.342426
2012-08-10 12:34:02.620 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.303715
2012-08-10 12:34:02.621 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 160.000000
2012-08-10 12:34:02.621 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 190.342426
2012-08-10 12:34:02.621 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.189640
2012-08-10 12:34:02.622 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 176.000000
2012-08-10 12:34:02.622 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 190.342426
2012-08-10 12:34:02.633 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.081491
2012-08-10 12:34:02.635 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 193.000000
2012-08-10 12:34:02.635 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 190.342426
2012-08-10 12:34:02.635 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 0.986230
2012-08-10 12:34:02.636 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 212.000000
2012-08-10 12:34:02.636 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 380.684853
2012-08-10 12:34:02.636 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.795683
2012-08-10 12:34:02.636 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 233.000000
2012-08-10 12:34:02.667 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 380.684853
2012-08-10 12:34:02.667 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.633841
2012-08-10 12:34:02.668 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 256.000000
2012-08-10 12:34:02.668 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 380.684853
2012-08-10 12:34:02.668 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.487050
2012-08-10 12:34:02.668 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 281.000000
2012-08-10 12:34:02.669 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 380.684853
2012-08-10 12:34:02.669 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.354750
2012-08-10 12:34:02.669 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 309.000000
2012-08-10 12:34:02.670 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 380.684853
2012-08-10 12:34:02.670 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.231990
2012-08-10 12:34:02.671 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 339.000000
2012-08-10 12:34:02.671 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 380.684853
2012-08-10 12:34:02.685 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.122964
2012-08-10 12:34:02.686 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 372.000000
2012-08-10 12:34:02.686 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 380.684853
2012-08-10 12:34:02.686 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.023346
2012-08-10 12:34:02.687 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 409.000000
2012-08-10 12:34:02.687 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 761.369705
2012-08-10 12:34:02.687 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.861540
2012-08-10 12:34:02.687 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 449.000000
2012-08-10 12:34:02.688 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 761.369705
2012-08-10 12:34:02.688 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.695701
2012-08-10 12:34:02.688 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 493.000000
2012-08-10 12:34:02.688 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 761.369705
2012-08-10 12:34:02.689 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.544360
2012-08-10 12:34:02.689 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 542.000000
2012-08-10 12:34:02.689 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 761.369705
2012-08-10 12:34:02.689 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.404741
2012-08-10 12:34:02.690 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 596.000000
2012-08-10 12:34:02.690 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 761.369705
2012-08-10 12:34:02.690 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.277466
2012-08-10 12:34:02.691 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 655.000000
2012-08-10 12:34:02.691 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 761.369705
2012-08-10 12:34:02.691 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.162396
2012-08-10 12:34:02.692 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 720.000000
2012-08-10 12:34:02.692 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 761.369705
2012-08-10 12:34:02.692 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.057458
2012-08-10 12:34:02.692 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 792.000000
2012-08-10 12:34:02.693 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 1522.739410
2012-08-10 12:34:02.693 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.922651
2012-08-10 12:34:02.693 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 871.000000
2012-08-10 12:34:02.693 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 1522.739410
2012-08-10 12:34:02.694 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.748266
2012-08-10 12:34:02.694 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 958.000000
2012-08-10 12:34:02.694 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 1522.739410
2012-08-10 12:34:02.694 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.589498
2012-08-10 12:34:02.695 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 1053.000000
2012-08-10 12:34:02.695 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 1522.739410
2012-08-10 12:34:02.695 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.446096
2012-08-10 12:34:02.695 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 1158.000000
2012-08-10 12:34:02.703 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 1522.739410
2012-08-10 12:34:02.703 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.314974
2012-08-10 12:34:02.704 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 1273.000000
2012-08-10 12:34:02.704 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 1522.739410
2012-08-10 12:34:02.704 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.196182
2012-08-10 12:34:02.705 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 1400.000000
2012-08-10 12:34:02.705 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 1522.739410
2012-08-10 12:34:02.705 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.087671
2012-08-10 12:34:02.706 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 1540.000000
2012-08-10 12:34:02.706 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 3045.478821
2012-08-10 12:34:02.706 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.977584
2012-08-10 12:34:02.707 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 1694.000000
2012-08-10 12:34:02.707 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 3045.478821
2012-08-10 12:34:02.707 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.797803
2012-08-10 12:34:02.707 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 1863.000000
2012-08-10 12:34:02.708 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 3045.478821
2012-08-10 12:34:02.708 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.634718
2012-08-10 12:34:02.708 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 2049.000000
2012-08-10 12:34:02.708 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 3045.478821
2012-08-10 12:34:02.709 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.486324
2012-08-10 12:34:02.709 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 2253.000000
2012-08-10 12:34:02.709 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 3045.478821
2012-08-10 12:34:02.710 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.351744
2012-08-10 12:34:02.710 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 2478.000000
2012-08-10 12:34:02.710 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 3045.478821
2012-08-10 12:34:02.710 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.229007
2012-08-10 12:34:02.711 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 2725.000000
2012-08-10 12:34:02.711 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 3045.478821
2012-08-10 12:34:02.711 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.117607
2012-08-10 12:34:02.712 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 2997.000000
2012-08-10 12:34:02.712 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 3045.478821
2012-08-10 12:34:02.712 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.016176
2012-08-10 12:34:02.713 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 3296.000000
2012-08-10 12:34:02.713 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 6090.957642
2012-08-10 12:34:02.713 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.847985
2012-08-10 12:34:02.714 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 3625.000000
2012-08-10 12:34:02.714 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 6090.957642
2012-08-10 12:34:02.714 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.680264
2012-08-10 12:34:02.714 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 3987.000000
2012-08-10 12:34:02.715 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 6090.957642
2012-08-10 12:34:02.715 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.527704
2012-08-10 12:34:02.715 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 4385.000000
2012-08-10 12:34:02.715 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 6090.957642
2012-08-10 12:34:02.716 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.389044
2012-08-10 12:34:02.716 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 4823.000000
2012-08-10 12:34:02.716 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 6090.957642
2012-08-10 12:34:02.716 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.262898
2012-08-10 12:34:02.717 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 5305.000000
2012-08-10 12:34:02.717 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 6090.957642
2012-08-10 12:34:02.717 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.148154
2012-08-10 12:34:02.718 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 5835.000000
2012-08-10 12:34:02.718 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 6090.957642
2012-08-10 12:34:02.718 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.043866
2012-08-10 12:34:02.719 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 6418.000000
2012-08-10 12:34:02.719 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 12181.915283
2012-08-10 12:34:02.719 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.898086
2012-08-10 12:34:02.719 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 7059.000000
2012-08-10 12:34:02.720 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 12181.915283
2012-08-10 12:34:02.720 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.725728
2012-08-10 12:34:02.720 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 7764.000000
2012-08-10 12:34:02.720 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 12181.915283
2012-08-10 12:34:02.721 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.569026
2012-08-10 12:34:02.721 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 8540.000000
2012-08-10 12:34:02.721 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 12181.915283
2012-08-10 12:34:02.721 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.426454
2012-08-10 12:34:02.722 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(403)> distanceWereInputing: 9394.000000
2012-08-10 12:34:02.722 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(404)> self.DistanceBetweenWestandEast: 12181.915283
2012-08-10 12:34:02.722 BadgerNew[16754:17003] <0x88b79b0 GoogleMap.m:(405)> self.DistanceBetweenWestandEast/distanceWereInputing: 1.296776

所以看起来谷歌缩放级别只能取一定的值。这就是为什么我们输入的内容与实际东西距离之间的比率在 1.7 到 0.95 之间变化的原因。

所以我只取平均 1.3 并在更改 MKMapview 大小时使用它。

于 2012-08-10T05:44:19.673 回答