【问题标题】:iphone gps giving incorrect locationiphone gps给出不正确的位置
【发布时间】:2011-07-06 04:37:19
【问题描述】:

我想用 iphone gps 功能显示用户的当前位置,但问题是它给出的位置不正确。 当我在地图上放下大头针时,它会将大头针放在确切的位置,但是当我尝试查看文本中的位置时,它给出的位置不准确,大约 500 到 800 米的不准确度。我使用了反向地理编码和谷歌 api,但都给出了相同的位置.请告诉我为什么会发生这种情况以及如何显示用户的确切位置? 我的代码是:

cllocationmanager *locationManager = [[CLLocationManager alloc] init];
        locationManager.delegate = self;
        locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move
        locationManager.desiredAccuracy = kCLLocationAccuracyBest; // 100 m
        [locationManager startUpdatingLocation];


    }

    }



- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation

{


 CLLocationCoordinate2D here =  newLocation.coordinate;
    NSLog(@"%f  %f ", here.latitude, here.longitude);


    MKReverseGeocoder *geocoder = [[MKReverseGeocoder alloc] initWithCoordinate:here];
    [geocoder setDelegate:self];
    [geocoder start];

        }



- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error{



}



- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
    NSLog(@"The geocoder has returned: %@", [placemark addressDictionary]);



    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:[NSString stringWithFormat:@"%@",[placemark addressDictionary]] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alertView show];
    [alertView release];


}

【问题讨论】:

  • 您能说一下您是如何验证位置的吗?您是否正在使用具有不同基准的地图?

标签: iphone objective-c gps mapkit


【解决方案1】:

快速猜测:你检查过 CLLocation 的水平精度吗?很多时候,我得到的第一个响应是非常不准确的,然后后续调用会变得更好。

编辑:@pankaj 首先,您能否确认这是一个准确性问题。如果这是我建议的问题,那么 CLLocation Horizo​​ntalAccuracy 会很大。如果不是这种情况,那么您可以忽略我的回答和这些 cmets。但是,如果 Horizo​​ntalAccuracy 是一个很大的错误,那么您将不得不等待更好的锁。有两种方法可以做到这一点:

  1. 稍等片刻(一两秒),看看是否能获得更好的锁。
  2. 更早开始请求位置,例如当应用启动时,或者需要位置的 UIViewController 启动时。

【讨论】:

  • 你是说你必须接受你收到的第一个输入吗?如果是,为什么?
  • 因为我想获取位置并将其发送到数据库以搜索该位置的用户。我无法花时间更新位置,因为无法确定更新正确位置的确切时间跨度>
  • 您将不得不等到 GPS 收到良好的信号,无法强制累积第一个接收到的位置。您收到的第一个位置是蜂窝塔三角测量,然后 GPS 启动,只需要一段时间即可获得良好的信号。您对此无能为力。只需构建一个您正在检索用户位置的微调器,然后等到您需要水平精度。
  • 除了我所在地区的名称之外,谷歌数据库中是否可能没有其他位置名称?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-07-20
  • 2011-08-06
  • 2011-06-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多