Table of Contents

Property GeometrySrid

Namespace
YndigoBlue.Velocity.Data
Assembly
YndigoBlue.Velocity.dll

GeometrySrid

Gets or sets the Spatial Reference System Identifier (SRID) applied to Geometry columns.

public virtual int GeometrySrid { get; set; }

Property Value

int

Remarks

This property only applies to the Geometry data type (DataType.Geometry). Geography columns take their SRID from GeographySrid instead.

Geometry data is planar: coordinates are treated as points on a flat Cartesian plane and all calculations use Euclidean math, so distances and areas come back in the coordinate system's own units rather than metres. The default value of 0 means "undefined coordinate system", which is what most databases use for unprojected planar data. Some databases have no SRID 0 in their spatial reference catalogue and reserve a different identifier for the same meaning — DB2, Oracle and Teradata all use 1 — so those connections default to that value instead.

Set this to a projected SRID (for example 3857 for Web Mercator, or a local grid such as 27700) when the planar coordinates you are storing belong to a known projection and you want the database to record it. The value is applied when geometry columns are created, when geometry parameters and literals are bound, and when imported geometry values are built, and it is also what distinguishes a geometry from a geography on datasources that return both through the same driver type.

warning

The GeometrySrid must match the SRID used when creating Geometry columns in the database. Changing it after data has been stored leaves existing rows tagged with the old identifier, which causes spatial predicates between old and new rows to fail outright on databases that require matching SRIDs. Set GeometrySrid correctly before storing any Geometry data.

Storing Web Mercator coordinates in a Geometry column:
var conn = new PostgreSqlDatasourceConnection
{
    Hostname = "server.example.com",
    Database = "GeoData",
    Username = "user",
    Password = "password",
    GeometrySrid = 3857  // Web Mercator — matches the Geometry columns in this database
};