mapview的定位与corelocation中的定位

mapview的定位是通过mapview.showuserlocation = yes / no来启动和结束的。一旦启动,它会周期性(周期未知)的更新地图中的蓝点的位置,但是如果进入后台,它就不会更新,并且开发人员对它的利用比较受限,corelocation中的定位是通过locationmanager来管理的,开发人员可以设置精度,有比较多的设置权限供开发人员使用,并且如果程序进入后台,它也能进行定位。而且很多情况下两种定位所得到的用户的位置并不重合。

apple doc:

Because it can take several seconds to return an initial location, the location manager typically delivers the previously cached location data immediately and then delivers more up-to-date location data as it becomes available. Therefore it is always a good idea to check the timestamp of any location object before taking any actions. If both location services are enabled simultaneously, they deliver events using the same set of delegate methods.


- (void) locationManager:(CLLocationManager*) manager didUpdateToLocation:(CLLocation*)newLocation fromLocation:(CLLocation*)oldLocation
{
if(newLocation.horizontalAccuracy > 100)
{
NSLog(@”Ignoring GPS location more than 100 meters inaccurate :%f”, newLocation.horizontalAccuracy);
return;
}

NSDate* eventDate = newLocation.timestamp;
NSTimeInterval howRecent = [eventDate timeIntervalSinceNow];
if (abs(howRecent) > 15.0)
{
NSLog(@”Ignoring GPS location more than 15 seconds old(cached) :%d”, abs(howRecent));
return;
}

.........

}

there is just noway to force the first received location to be accrued. The first location you receive is cell tower triangulation, then the GPS get fired up and it just takes a while to get a good signal

定位所获取的位置精度取决于信号强度,获取定位数据主要有三种来源:手机基站,gps, wifi positioning service(wps)

手机基站的普通信息可以用technology.framework public api获取,如运营商名字,一些数据只能通过private api获取。

地图的定位有误差,特别是在中国大陆,由于政府的法规,电子地图都有偏移,每个城市偏移程度不同。有两种校正方法:1,通过每个城市的精确的两点的偏移来换算这个城市的其他地点的偏移。2,使用高德地图提供的api来转换,但是它提供的api对使用是有限制的。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值