-
Notifications
You must be signed in to change notification settings - Fork 1
first_point
Maarten Hilferink edited this page Apr 8, 2026
·
1 revision
Geometric functions first_point
The first_point function extracts the first point from each sequence (arc, polygon, or linestring).
first_point(sequences: E->Sequence<Point>) -> E->Point
Returns the first point of each sequence geometry. For:
- Arcs/linestrings: The starting point of the line
- Polygons: The first vertex (which equals the last vertex for closed rings)
- Empty sequences: Returns undefined (null)
This is the counterpart to last_point.
| argument | description | type |
|---|---|---|
| sequences | Attribute containing sequence geometries | E->Sequence |
Time complexity: O(n) where n is the number of sequences (constant time per sequence).
Memory efficient as it only accesses the first element of each sequence without loading entire geometries.
- Input must be a sequence type (arc, polygon, linestring)
- Result is undefined for empty sequences
unit<uint32> Roads: nrofrows = 100;
attribute<FPoint> geometry (poly, Roads); // road linestrings
// Get start and end points of each road
attribute<FPoint> start_point (Roads) := first_point(geometry);
attribute<FPoint> end_point (Roads) := last_point(geometry);
// Check if roads form closed loops
attribute<Bool> is_closed (Roads) := start_point = end_point;
- last_point - extracts last point
- sequence2points - extracts all points from sequences
- centroid - center of mass of geometry
- Geometric functions
- Sequence functions
5.0
GeoDMS ©Object Vision BV. Source code distributed under GNU GPL-3. Documentation distributed under CC BY-SA 4.0.