iOS 开发:中国地图偏移
我制作了一个非常简单的应用程序,在其中我可以将一根大头针扔到我所站的位置上(只是初学者的练习)。但我发现了一个问题。
我发誓我既没有在移动,设备也没有认为我在移动。我直接使用地理位置来设置 pin。但图钉与当前位置的蓝点相距数百米。
(顺便说一句,蓝点代表了我当时的真实位置。)
这是中国 iOS 版谷歌地图的一个著名问题。抛开所谓国家安全这个复杂的问题,我需要帮助的是作为开发者我们应该做什么。从技术上讲,在编程中是否有一种方法可以找出偏移量并纠正它?
有人知道吗?
I made a very simple APP in which I can throw a pin right onto the location I am standing at (just a beginner's practice). But I found a problem.
I swear neither I was moving nor the device thought I was moving. And I directly use the geolocation to set the pin. but the pin and the current-location blue point are hundreds of meters apart.
(By the way, the blue point expressed my real location at the time.)
This is a famous problem of Google Map on iOS in China. Put aside the complicated issue of the so-called national security, where I want help is what should we do as a developer. Technically, is there a way, in programming, to figure out what exactly the offset is and correct it?
Does anyone have any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您什么时候放置图钉? iOS 拥有多达三个位置数据源(手机信号塔三角测量、Wifi 嗅探和 GPS),并将让您及时了解最准确的最新信息。通常,您会得到一个不太准确的位置,然后是一个更准确的位置,然后是一个更准确的位置。
如果您打开了
MKMapView
,那么您可以做的就是对其userLocation
属性进行键值观察,而不是启动任何类型的CLLocationManager
。这样,您将始终更新地图视图确定的当前位置,这意味着您不需要尝试将您的逻辑与其匹配。At what time did you place the pin? iOS has up to three sources of location data (cell tower triangulation, Wifi sniffing and GPS) and will keep you up to date with the most accurate. So often you get a not very accurate location, then a more accurate location, then an even more accurate location.
If you have a
MKMapView
open then something you can do is key-value observe on itsuserLocation
property rather than starting any sort ofCLLocationManager
. That way you'll always be updated with whatever the map view has decided is the current location, meaning that you don't need to try to match your logic to its.我对偏移做了一些研究,但还没有得到令人满意的结果。添加的偏移是确定性的,即给定位置,偏离的位置是固定的。所以我的目标是得到偏差函数 f(p)=p',其中 p 和 p' 都是 2D 点。您可以这里查看如果你有兴趣。
I did some research on the offset, but haven't gotten a satisfying result yet. The added offset is deterministic, i.e. given a location, the deviated location is fixed. So my goal is to get the deviation function, f(p)=p', where both p and p' are 2D points. You can check here if you are interested.