Point_in_all_polygons - ObjectVision/GeoDMS GitHub Wiki

Geometric functions point_in_all_polygons

syntax

  • point_in_all_polygons(point_data_item, polygon_data_item)

definition

point_in_all_polygons(point_data_item, polygon_data_item) results in a new uint32 domain unit with two subitems: first_rel and second_rel.

These subitems indicate which point is located in which polygons, as a point can be located in multiple polygons and a polygon can contain multiple points, this is an n to n relation.

The first_rel item contains the relation to the point_data_item.

The second_rel item contains the relation to the polygon_data_item.

applies to

since version

8.035

performance

O(n log p + n * c + r) where n = number of points, p = number of polygons, c = the cost of testing a point against a polygon whose bounding box holds it, and r = number of result pairs. Builds spatial index on polygons. Result size can grow large when points fall in many overlapping polygons.

The cost c does not grow with the number of vertices of a polygon: a polygon of at least 32 vertices gets an edge index when there are at least 4 points per such polygon, and a point reads only the edges near its own row; see point_in_polygon. The edge index does not change the result.

example

unit<uint32> district_relations := point_in_all_polygons(Pointdomain/point, district/geometry);
first_rel second_rel
0 0
1 1
2 0
2 1
Pointdomain/id Pointdomain/label Pointdomain/point
0 A xy(115135; 401331)
1 B xy(111803; 399476)
2 C xy(114903; 399289)

domain Pointdomain, nr of rows = 3

District/id District/geometry
0 {21:xy(113810; 403025),{4
1 {17:xy(113269; 400990),{4

domain District, nr of rows = 2

see also

⚠️ **GitHub.com Fallback** ⚠️