覆盖整个区域的最佳方式通过邮政编码进行搜索

路易斯·拉蒙·拉米雷斯·罗德里格斯

我想按邮政编码进行搜索,邮政编码由多边形定义,如下图所示:

在此处输入图片说明

问题是,实际上,我无法在邮政编码本身上进行搜索,而是在该邮政编码质心的区域中进行搜索,例如对于邮政编码 4,该区域也与 1,2 和 5 相关联。

在此处输入图片说明

以同样的方式,对 1 的搜索也会从 2、3、4 和 6 中获取结果。

在此处输入图片说明

因此,为了避免重复,我想找出我可以用较少的搜索次数获得所有结果的邮政编码,比如 take 4 和 6

在此处输入图片说明

而不是 2,5 和 6

在此处输入图片说明

我该如何解决这个问题?

桑乔斯复职莫妮卡塞利奥

I am not sure I fully understood your objective. If you provide one or two examples of the input you give, and the corresponding output you mean to get, that would help others help you.

I assume your problem is the following:
You have a given partition of your 2D region (country, area, etc.) into N finite size polygons Pi, numbered i=1...N. Partition here means that the union of all your N polygons covers your domain, and the intersection between any two polygons is of dimension 1, at most. I.e., they can share boundaries, at most, no overlaps. You mean to give a target spatial coordinate X=(x,y), and get the number j of the polygon to which it belongs.
So far, you can compute the centroid Qi of each polygon and the minimal circle Ci centered at Qi that fully includes the polygon Pi, and find all circles {Cj} that contain your target X. But there is an overlap among several Ci (i.e., {Ci} is not a partition of you region), so a given target may belong to more than one Ci.


If I got this right, this is a Point in polygon problem, which has well known solutions for either convex or non-convex polygons (since you did not specify that).

Some links are provided below. A few notes:

  • I don't think you would need this, but you may speed up a little you code by first applying your algorithm to get a smaller set of candidate polygons, and then apply the point-in-polygon algorithm on this reduced set.

  • If your subregions are not polygons, the problem becomes harder. It depends on the shapes of the boundaries.

  • Mathematically speaking, you still have to decide what happens with poins exactly on boundaries.


Links specific for python:

What's the fastest way of checking if a point is inside a polygon in python

Python: checking if point is inside a polygon

https://automating-gis-processes.github.io/CSC18/lessons/L4/point-in-polygon.html

https://gis.stackexchange.com/questions/170264/python-point-in-polygon-boundary-and-vertex-check-ray-casting

Other generic links:

How can I determine whether a 2D Point is within a Polygon?

https://en.wikipedia.org/wiki/Point_in_polygon

https://www.geeksforgeeks.org/how-to-check-if-a-given-point-lies-inside-a-polygon/

http://alienryderflex.com/polygon/

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

用于邮政编码搜索的Google Maps API区域参数

来自分类Dev

搜索邮政编码范围并拉出相应的区域

来自分类Dev

用于邮政编码搜索的Google Maps API区域参数

来自分类Dev

Mysql 搜索邮政编码

来自分类Dev

在Excel中搜索多个邮政编码

来自分类Dev

T SQL通配符搜索邮政编码

来自分类Dev

寻找Joomla的邮政编码半径搜索

来自分类Dev

在Excel中搜索多个邮政编码

来自分类Dev

通过邮政编码映射Reporting Services

来自分类Dev

从数据库中具有纬度/经度的邮政编码进行地理搜索

来自分类Dev

按距离对邮政编码附近搜索进行排序(php / mysql)

来自分类Dev

通过邮政编码和特定范围内的过滤器列表搜索?

来自分类Dev

在 R 中绘制邮政编码区域 - 如何添加图例

来自分类Dev

邮政编码验证

来自分类Dev

邮政编码

来自分类Dev

在Oracle中存储邮政编码的最佳数据类型

来自分类Dev

如何使用空间搜索邮政编码的半径?

来自分类Dev

Apache Solr-Lucene-邮政编码半径搜索

来自分类Dev

ROR API尝试创建邮政编码搜索

来自分类Dev

熊猫数据框搜索并修改邮政编码的前导零

来自分类Dev

如何使用空间搜索邮政编码的半径?

来自分类Dev

jQuery邮政编码搜索和inArray重定向

来自分类Dev

谷歌地图 API 搜索特定国家的邮政编码

来自分类Dev

邮政编码和使用Java进行国家/地区匹配

来自分类Dev

如何通过前缀正确匹配英国邮政编码?

来自分类Dev

如何通过邮政编码确定美国县?

来自分类Dev

如何通过前缀正确匹配英国邮政编码?

来自分类Dev

通过基于R中的邮政编码对行进行平均划分来创建两个数据集

来自分类Dev

邮政编码使用结构

Related 相关文章

热门标签

归档