在移动设备上进行离线反向地理编码的技术?
我正在开发一个移动地图应用程序(目前是 iOS,最终是 Android) - 我正在努力解决如何在不使用在线服务的情况下最好地支持从纬度/经度到国家/州的反向地理编码。
Apple 的反向地理编码 API 依赖于 Google 作为后端,并且在连接时运行良好。我也可以使用 Open Street Maps 项目或任意数量的其他 Web 服务来实现类似的功能。
然而,我真正想要的是创建一个 C 库,即使在应用程序中离线时我也可以调用该库,传递 GPS 坐标,并让它返回这些坐标处的国家/地区和/或州。我不需要比州级更细的粒度,因此数据集并不大。
我见过如何在服务器上执行此操作的示例,但从未见过任何适合移动设备的示例。
我听说 Spatialite 可能是一个解决方案,但我不确定如何让它发挥作用在 iOS 上,我想知道对于这个问题来说这是否有点过分了。
有哪些推荐的技术可以实现这一目标?
I am working on a mobile mapping application (currently iOS, eventually Android) - and I am struggling with how to best support reverse geocoding from lat/long to Country/State without using an online service.
Apple's reverse geocoding API depends on Google as the backend, and works great while connected. I could achieve similar functionality using the Open Street Maps project too, or any number of other web services.
What I really want however is to create a C library that I can call even when offline from within my application, passing in the GPS coordinates, and having it return the country and/or state at those coordinates. I do not need finer granularity than state-level, so the dataset is not huge.
I've seen examples of how to do this on a server, but never anything appropriate for a mobile device.
I've heard Spatialite might be a solution, but I am not sure how to get it working on iOS, and I wonder if it may be overkill for the problem.
What are some recommended techniques to accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Radven
您将需要获取所有行政实体(美国各州、国家等)的 Shapefile(纬度/经度轮廓)。这些有很多公共领域的资源。例如,NOAA 有美国各州和地区的 shapefile,您可以下载:
http://www.nws.noaa.gov/geodata/catalog/national/html/us_state.htm
获得 shapefile 后,您可以使用 shapefile 阅读器来测试 lat/lng 是否在形状。 C语言有开源阅读器,google一下就可以了。我在 sourceforge 上看到过关于 shapefile 的东西,但我自己没有使用过。
OpenGeoCode.Org 团队
Radven
You will need to get the Shapefiles (lat/lng outline) of all the administrative entities (US states, countries, etc). There are a lot of public domain sources for these. For example, the NOAA has shapefiles for US states and territories you can download:
http://www.nws.noaa.gov/geodata/catalog/national/html/us_state.htm
Once you got the shapefiles, you can use a shapefile reader to test if a lat/lng is within a shape. There are open source readers in C, just google. I seen stuff at sourceforge for shapefiles, but have not used these myself.
The Team at OpenGeoCode.Org
如果您正在寻找基于四叉树的方法,请尝试 Yggdrasil。它根据国家多边形数据生成四叉树。可以在此处找到 Ruby 示例脚本。
If you're looking for an approach based on a quadtree, try Yggdrasil. It generates a quadtree based on country polygon data. A Ruby example script can be found here.
我可以建议编写好的离线地理编码第三方库。
https://github.com/Alterplay/APOfflineReverseGeocoding
I can suggest good written offline geocoding 3rd party library.
https://github.com/Alterplay/APOfflineReverseGeocoding