Class SpatialX
- Namespace
- YndigoBlue.Velocity.Functions
- Assembly
- YndigoBlue.Velocity.dll
Represents the ST_X spatial accessor function that returns the X coordinate of a point geometry.
public class SpatialX : Function, ICheckItem, IDefaultItem, IFilterItem, IElement
- Inheritance
-
SpatialX
- Implements
Remarks
Warning
Spatial functions are not available in the Community Edition of Velocity. They require the Full Edition.
The ST_X function returns the X coordinate (longitude or easting) of a point geometry. For non-point geometries, the result is typically null or undefined. The X coordinate represents the horizontal position in the coordinate reference system. For geographic coordinates, X is longitude. For projected coordinates, X is the easting value. For Geometry types in planar coordinate systems, this is useful for extracting coordinates, coordinate transformations, or point analysis. OGC-compliant.
Return Type: Double (X coordinate value).
| Point Geometry | ST_X Result |
|---|---|
| POINT(200 100) | 200 |
| POINT(-98.5 38.2) | -98.5 (longitude) |
| LineString, Polygon | NULL |
Examples
Retrieve the X (longitude) coordinate of each point location in a stores table:
var schema = manager.LoadSchema("retail");
var stores = schema["stores"];
var query = new Query()
.Select([ stores["id"], stores["name"], new Expression("longitude", new SpatialX(stores["location"])) ])
.From(stores);
var results = manager.Retrieve(query);
Constructors
- SpatialX(Geometry)
Initializes a new instance of ST_X with a point geometry literal.
- SpatialX(Column)
Initializes a new instance of ST_X with a point geometry column.
- SpatialX(Function)
Initializes a new instance of ST_X for a function result.
- SpatialX(Geography)
Initializes a new instance of ST_X with a point geography literal.