last_point - ObjectVision/GeoDMS GitHub Wiki

Geometric functions last_point

The last_point function extracts the last point from each sequence (arc, polygon, or linestring).

syntax

last_point(sequences: E->Sequence<Point>) -> E->Point

definition

Returns the last point of each sequence geometry. For:

  • Arcs/linestrings: The endpoint of the line
  • Polygons: The last vertex (which equals the first vertex for closed rings)
  • Empty sequences: Returns undefined (null)

This is the counterpart to first_point.

arguments

argument description type
sequences Attribute containing sequence geometries E->Sequence

performance

Time complexity: O(n) where n is the number of sequences (constant time per sequence).

Memory efficient as it only accesses the last element of each sequence without loading entire geometries.

conditions

  • Input must be a sequence type (arc, polygon, linestring)
  • Result is undefined for empty sequences

example

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);

// Road length from first to last point (simplified)
attribute<Float64> straight_distance (Roads) := dist(start_point, end_point);

see also

since version

5.0

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