geo.ST_Length() function
The geo.ST_Length()
function is experimental and subject to change at any time. By using this function, you accept the risks of experimental functions.
The geo.ST_Length()
function returns the spherical length or distance of the specified geographic information system (GIS) geometry. Define distance units with the geo.units
option.
*Function type: Transformation*
import "experimental/geo"
geo.ST_Length(
geometry: {linestring: "39.7515 14.01433, 38.3527 13.9228, 36.9978 15.08433"}
)
// Returns 346.1023974652474 (km)
Parameters
geometry
The GIS geometry to measure. Can be either point or linestring geometry. Points will always return 0.0
. See GIS geometry definitions.
*Data type: Record*
Examples
Calculate the length of geographic paths
import "experimental/geo"
region = {
minLat: 40.51757813,
maxLat: 40.86914063,
minLon: -73.65234375,
maxLon: -72.94921875
}
data
|> geo.toRows()
|> geo.asTracks()
|> geo.ST_LineString()
|> map(fn: (r) => ({
r with st_length: geo.ST_Length(geometry: {linestring: r.st_linestring})
}))