arc_length - ObjectVision/GeoDMS GitHub Wiki

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. Since GeoDMS 20.3.0 it also converts: coordinates in metres read out as arc_length(road/geometry, km) give kilometres, where before 20.3.0 the second argument only relabelled the metres and you had to divide by 1000 yourself. A values unit whose metric does not match the metric of the coordinates at all is reported as a warning and still accepted as a label, which is deprecated behaviour.

Since GeoDMS 20.3.0 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.

Since GeoDMS 20.19.2 that single-argument form also works on coordinates that have a metric, which is the normal case for a projected SpatialReference. Before 20.19.2 it crashed the GeoDMS GUI on exactly those coordinates; see area, where the same derivation is described.

Furthermore, note that multi-linestrings are sequences of points that contain values as separators between linestrings and that arc-length returns for any point sequence that contains one or more values. For multi-linestrings, use the function mls_length.

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

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

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