Class SpatialLength
- Namespace
- YndigoBlue.Velocity.Functions
- Assembly
- YndigoBlue.Velocity.dll
Represents the ST_Length spatial measurement function that computes the length of a linear geometry.
public class SpatialLength : Function, IElement, ICheckItem, IDefaultItem, IFilterItem
- Inheritance
-
SpatialLength
- Implements
Remarks
Warning
Spatial functions are not available in the Community Edition of Velocity. They require the Full Edition.
The ST_Length function returns the total length of a linestring or multi-linestring geometry. For polygons, it may return the perimeter. For points, typically returns 0. For Geometry types, length is in coordinate system units. For Geography types, length is calculated using spherical geometry and can be specified with a unit of measure (meters, kilometers, miles, etc.). This is useful for measuring distances, calculating route lengths, or analyzing linear features. OGC-compliant.
Return Type: Numeric (float/double). Units depend on coordinate system or specified UnitOfMeasure.
Length by Geometry Type:
| Input Type | Length Result |
|---|---|
| POINT | 0 (no length) |
| LINESTRING | Total length of the line |
| Multi-segment LINE | Sum of all segment lengths |
| POLYGON | Perimeter (sum of ring lengths) |
| MULTILINESTRING | Sum of all line lengths |
Example Results (using test geometries):
| Shape | Length (in degrees) |
|---|---|
| LN1 (vertical, 2° tall) | 2.0 |
| Diagonal line (2°×2°) | ~2.83 (√8) |
| Multi-segment line | Sum of segment lengths |
| Polygon (perimeter) | Sum of all edges |
| PT1 (point) | 0 |
Units of Measure: For Geography types, use UnitOfMeasure to get results in meters, kilometers, miles, or other supported units.
Constructors
- SpatialLength(Geometry)
Initializes a new instance of ST_Length with a geometry literal.
- SpatialLength(Column)
Initializes a new instance of ST_Length with a geometry column.
- SpatialLength(Column, UnitOfMeasure)
Initializes a new instance of ST_Length with a geography column and unit of measure.
- SpatialLength(Function)
Initializes a new instance of ST_Length for a function result (e.g., from another spatial operation).
- SpatialLength(Function, UnitOfMeasure)
Initializes a new instance of ST_Length for a function result with a unit of measure.
- SpatialLength(Geography, UnitOfMeasure)
Initializes a new instance of ST_Length with a geography literal and unit of measure.