Measure Length
The length of each line, as a number or a new attribute.
Pitfall. In a geographic CRS, planar engines return degrees.
Pitfall. For polygons, some functions return the perimeter and others 0 (PostGIS ST_Length); use a perimeter function for outlines.
| Also called | Calculate Geometry (length), line length, shape length, perimeter |
|---|---|
| Group | vector/measure |
| Checks | crs.measure |
| Pitfalls | 2 listed above |
| Columbus tool | Not stated |
| Notes | Not stated |
| Status | active |
| Broader | Not stated |
| Narrower | Not stated |
| Related |
Parameters
| Name | Type | Required | Default | Values | Note |
|---|---|---|---|---|---|
unit | enum | no | m | m, ft, us-ft, km, mi | Not stated |
Inputs and outputs
| Direction | Name | Type | Geometry | Note |
|---|---|---|---|---|
| Input | layer | vector | line | Not stated |
| Output | output | any | Not stated | The lengths, or the layer with a length attribute. |
In each engine
| Engine | Tool | Parameters | Differences |
|---|---|---|---|
apache-sedona | sedona.sql.ST_Length |
|
|
geopandas | geopandas.GeoSeries.length |
|
|
grass | v.to.db |
|
Preset: {"option":"length","columns":"length"} |
postgis | st_length |
|
|
qgis | native:exportaddgeometrycolumns |
|
|
sf | sf::st_length |
|
|
shapely | shapely.length |
|
|
terra | terra::perim |
|
|
turf-js | turf.length |
|
|