Arc_length
Geometric functions arc_length
syntax
- arc_length(arc_poly_dataitem, valuesunit of coordinate system)
- arc_length(arc_poly_dataitem)
definition
arc_length(arc_poly_dataitem, valuesunit) calculates the length of an Arc or the outline of a Polygon Data item arc_poly_dataitem.
The resulting Values unit is configured as second Argument, and the length is converted to it: coordinates in metres read out as arc_length(road/geometry, km) give kilometres. A values unit whose Metric does not match the metric of the coordinates at all is deprecated: it is accepted as a label, with a warning.
The second argument may also be left out. arc_length(arc_poly_dataitem) derives the resulting Values unit from the coordinates themselves, so m for a Coordinate system in metres. This also works on coordinates that have a metric, which is the normal case for a projected SpatialReference; see Area, where the same derivation is described.
Furthermore, note that multi-linestrings are sequences of points that contain
description
The definition of the outline of a polygon is only equal to the perimeter if the polygon has no islands and lakes.
In case a polygon consists of multiple rings, the outline also contains the artificial lines needed to relate the rings, see Polygon data model.
If you want to calculate the perimeter, use a Split_polygon function first to make different polygons for all exterior rings (the outline of the lakes are still a part of the calculated arc_length).
applies to
- arc or polygon data item arc_poly_dataitem with fpoint or dpoint Value type and composition type arc or polygon.
since version
The conversion to the values unit of the second argument, and the form without that argument, since 20.3.0; the form without a values unit on coordinates that have a metric since 20.19.2.
example
attribute<meter> road_length (Road) := arc_length(road/geometry, meter);
attribute<meter> road_length_v2 (Road) := arc_length(road/geometry); // same values, meter derived from the coordinates
| road/geometry | road_length |
|---|---|
| {2: xy(112631; 399246) xy(111866; 398599)} | 1001.92 |
| {3: xy(111866; 398599) xy(111924; 399495) xy(111524; 401801)} | 3238.31 |
| {2: xy(114921; 401529) xy(114823; 398584)} | 2946.63 |
domain Road, nr of rows = 3