无Web访问的反向地理编码 [英] Reverse Geocoding Without Web Access
问题描述
我正在研究一个应用程序,其中一个要求是我能够基于GPS数据执行实时反向地理编码操作。特别是,我必须能够确定一个经纬度对映射的州/省,并检测我们何时从一个州/省转移到另一州/省。
到目前为止,我有一些想法,但是想知道是否有人对以下任一方面有任何想法:
- 解决此问题的最佳方法是什么问题有效吗?
- 哪里可以找到适合北美洲州/省界限的适当格式
首先,我有两个主要想法:
- 将北美打入网格中的每个矩形都映射到特定的省份。根据纬度和经度(反之亦然),在这张表格上查找(快速增长,更精确)。
- 为每一个定义多边形状态并进行某种计算来确定经度/纬度对在哪个多边形中。我不确定如何去做这件事。 HTML图像映射让人想起它作为一种为州/省界定界限的方法。
我正在为感兴趣的python工作或者可能有一个很好的库,他们希望建议。
要清楚...我没有可用的Web访问,所以使用现有的反向地理编码服务不是运行时的选项
我建议使用您的第一个想法的变体:使用空间索引。空间索引是从矩形构建的数据结构,将纬度/长度映射到有效载荷。在这种情况下,您可能会将矩形映射到省级对。 R-tree 可能是一个不错的选择。这是一个 R-tree python包。您可以通过比较连续搜索的结果来检测漫游。
I am working on an application where one of the requirements is that I be able to perform realtime reverse geocoding operations based on GPS data. In particular, I must be able to determine the state/province to which a latitude, longitude pair maps and detect when we have moved from one state/province to another.
I have a couple ideas so far but wondered if anyone had any ideas on either of the following:
- What is the best approach for tackling this problem in an efficient manner?
- Where is a good place to find and what is the appropriate format for North American state/province boundaries
As a starter, here are the two main ideas I have:
- Break North America into a grid with each rectangle in the grid mapping to a particular state province. Do a lookup on this table (which grows quickly the more precise you would like to be) based on the latitude and then the longitude (or vice versa).
- Define polygons for each of the states and do some sort of calculation to determine in which polygon a lat/lon pair lies. I am not sure exactly how to go about this. HTML image maps come to mind as one way of defining the bounds for a state/province.
I am working in python for the interested or those that might have a nice library they would like to suggest.
To be clear... I do not have web access available to me, so using an existing reverse geocoding service is not an option at runtime
I suggest using a variant of your first idea: Use a spatial index. A spatial index is a data structure built from rectangles, mapping lat/long to the payload. In this case you will probably map rectangles to state-province pairs. An R-tree may be a good option. Here's an R-tree python package. You could detect roaming by comparing the results of consecutive searches.
这篇关于无Web访问的反向地理编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!