connect_info - ObjectVision/GeoDMS GitHub Wiki
Network functions connect_info
- connect_info(arcs, points, [optional] maxSqrDist)
- connect_info(points, arcs, [optional] maxSqrDist)
The connect_info(arcs, points) function is used to get information for each entry in the domain unit of attribute points on how the connect function (second variant) results in a connection to the attribute arcs.
The connect_info has the same arguments as the connect function.
The connect_info results in a container with a set of attributes for the same domain unit as the points.
The result contains the following attributes:
- dist: the distance between the point from the points and the CutPoint on the arc/polygon outline from the arcs;
- ArcID: the relation for each entry of the domain unit of the points to the connected arc of the arcs domain unit;
- CutPoint: The coordinate of the connection point on the arcs;
- InArc: true if the CutPoint is not the first or last point;
- InSegm: true if the CutPoint is not an (intermediate or final) point of the sequence of points;
- SegmID: the id of the segment in the arc to which the point is connected.
Since GeoDMS 20.19.2 the two geometry arguments may be given in the other order: connect_info(points, arcs) — a point data item first, an arc or polygon data item second. The points are then a choice set: for each entry of the domain unit of arcs, the nearest of the points is selected, measured to the nearest location on that arc. The result is a container for the domain unit of the arcs, with:
- dist: the distance between the selected point and the CutPoint on this arc;
- point_rel: the relation towards the domain unit of the points. This member replaces arc_rel, which only exists in the forward direction (with its deprecated ArcID alias);
- CutPoint, InArc, InSegm, SegmID: as above, all describing the connection on this arc.
Note that this is not the transpose of the forward result: the point nearest to an arc need not have that arc as its own nearest arc. An arc for which no point qualifies gets a null point_rel and a dist of the maximum float value.
The optional maxSqrDist is the square of the maximum distance each arc is allowed to look around, and therefore has the domain unit of the arcs (or is a parameter). In the forward direction it has the domain unit of the points, as before.
The reversed order is available for connect_info_eq, connect_info_ne, dist_info and connect in the same way. For the _eq / _ne variants the match data items travel with their own geometry, so the argument list stays (points, point_match_dataitem, arcs, arc_match_dataitem), and it is now the arc whose null match value waives the comparison — the mirror of the forward rule.
The arcs should contain unique geometries. Use the unique function to make a domain unit with unique geometries.
- data items arcs and points with fpoint or dpoint value type
- data item arcs with composition type arc or polygon. Be aware, if you connect points to polygons, use a split_polygon to avoid connecting to segments that separate different rings (lakes or islands) in a polygon.
The value type of arcs and points must match.
O(n * log m + n * k) where n = number of points, m = number of arc segments, and k = average segments per geometry. Same complexity as connect variant 2, but returns detailed connection information instead of new geometry.
container location2road := connect_info(road/geometry, location/geometry);
| road/geometry |
|---|
| {2: xy(112631; 399246) xy(111866; 398599)} |
| {3: xy(111866; 398599) xy(111924; 399495) xy(111524; 401801)} |
| {2: xy(114921; 401529) xy(114823; 398584)} |
domain road, nr of rows = 3
| location/geometry |
|---|
| xy(114903; 398600) |
| xy(111741; 398696) |
| xy(112601; 399138) |
| xy(114903; 399289) |
| xy(111803; 399476) |
| xy(115135; 401331) |
| xy(111353; 401729) |
| xy(112156; 401729) |
domain location, nr of rows = 8
| dist | ArcID | CutPoint | InArc | InSegm | SegmID |
|---|---|---|---|---|---|
| 79.42 | 2 | xy(114824; 398603) | True | True | 0 |
| 131.00 | 1 | xy(111872; 398688) | True | True | 0 |
| 63.09 | 0 | xy(112560; 399186) | True | True | 0 |
| 56.51 | 2 | xy(114847; 399291) | True | True | 0 |
| 119.52 | 1 | xy(111922; 399468) | True | True | 0 |
| 220.47 | 2 | xy(114915; 401338) | True | True | 0 |
| 180.79 | 1 | xy(111531; 401760) | True | True | 1 |
| 610.40 | 1 | xy(111555; 401625) | True | True | 1 |
domain location, nr of rows = 8
- connect
- connect_matrix - all points within a cutoff per feature, not only the nearest one
- connect_info_eq
- connect_info_ne
- dist_info