偶然在一个demo中的找到了解决偏差的另外一种方法;<起初转载了篇文章有两种方法>
1, MKMapView *_mapView;
- (void)findMe:(id)sender{
self.cllocationManager = [[[CLLocationManageralloc]init]autorelease];
self.cllocationManager.delegate =self;//对应下面的委托方法121
self.cllocationManager.desiredAccuracy =kCLLocationAccuracyBest;
self.cllocationManager.distanceFilter =1.0f;
[self.cllocationManagerstartUpdatingLocation];
}
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
weidu.text = [NSStringstringWithFormat:@"%3.5f",newLocation.coordinate.latitude];
jingdu.text = [NSStringstringWithFormat:@"%3.5f",newLocation.coordinate.longitude];
//以上的经度,维度若要对应此newLocation映射到地图上面会有偏移,大家所谓的火星座标;而有时候我们需要方向编码查出响应的位置等信息,获取正确的信息我们可以以来之前申明的
//_mapView.userLocation.location由字面意思及用户的位置信息,包含经度维度,等等
CLGeocoder *geocoder = [[CLGeocoderalloc]init];
[geocoder reverseGeocodeLocation: _mapView.userLocation.locationcompletionHandler:^(NSArray*array,NSError *error) {
if (array.count > 0) {
CLPlacemark *placemark = [array objectAtIndex:0];
NSString *country = placemark.ISOcountryCode;
NSString *city = placemark.locality;
NSLog(@"%@",placemark);
}
}];
// self.cllocationManager.distanceFilter = 1.0f; 距离变动有1m后回调此方法,然而此时我们又可以获取到真实的location。
2012-12-23 01:33:42.819 MapDemo[28470:707]中国四川省成都市青羊区小关庙街37号,中国四川省成都市青羊区小关庙街37号 @ <+30.66883500,+104.08376400> +/- 100.00m, region (identifier <+30.66883500,+104.08376400> radius 62.07) <+30.66883500,+104.08376400> radius 62.07m
//修正了的信息
2012-12-23 01:31:43.256 MapDemo[28449:707]中国四川省成都市青羊区北书院街,中国四川省成都市青羊区北书院街 @ <+30.66629472,+104.08632278> +/- 100.00m, region (identifier <+30.66684850,+104.08665200> radius 93.92) <+30.66684850,+104.08665200> radius 93.92m