Table of Contents

Class NpgsqlNetTopologySuiteDbFunctionsExtensions

Namespace
Microsoft.EntityFrameworkCore
Assembly
Npgsql.EntityFrameworkCore.PostgreSQL.NetTopologySuite.dll

Provides Npgsql-specific spatial extension methods on DbFunctions.

public static class NpgsqlNetTopologySuiteDbFunctionsExtensions
Inheritance
NpgsqlNetTopologySuiteDbFunctionsExtensions
Inherited Members

Methods

Distance(DbFunctions, Geometry, Geometry, bool)

Returns the minimum distance between the origin geometry and another geometry g. Translates to ST_Distance.

public static double Distance(this DbFunctions _, Geometry geometry, Geometry anotherGeometry, bool useSpheroid)

Parameters

_ DbFunctions

The DbFunctions instance.

geometry Geometry

The origin geometry.

anotherGeometry Geometry

The geometry from which to compute the distance.

useSpheroid bool

Whether to use sphere or spheroid distance measurement.

Returns

double

The distance between the geometries.

Remarks

DistanceKnn(DbFunctions, Geometry, Geometry)

Returns the 2D distance between two geometries. Used in the "ORDER BY" clause, provides index-assisted nearest-neighbor result sets. Translates to <->.

public static double DistanceKnn(this DbFunctions _, Geometry geometry, Geometry anotherGeometry)

Parameters

_ DbFunctions

The DbFunctions instance.

geometry Geometry

The origin geometry.

anotherGeometry Geometry

The geometry from which to compute the distance.

Returns

double

The 2D distance between the geometries.

Remarks

Force2D<TGeometry>(DbFunctions, TGeometry)

Forces the geometries into a "2-dimensional mode" so that all output representations will only have the X and Y coordinates. Translates to ST_Force2D(geometry)

public static TGeometry Force2D<TGeometry>(this DbFunctions _, TGeometry geometry) where TGeometry : Geometry

Parameters

_ DbFunctions
geometry TGeometry

Returns

TGeometry

Type Parameters

TGeometry

Remarks

IsWithinDistance(DbFunctions, Geometry, Geometry, double, bool)

Tests whether the distance from the origin geometry to another is less than or equal to a specified value. Translates to ST_DWithin.

public static bool IsWithinDistance(this DbFunctions _, Geometry geometry, Geometry anotherGeometry, double distance, bool useSpheroid)

Parameters

_ DbFunctions

The DbFunctions instance.

geometry Geometry

The origin geometry.

anotherGeometry Geometry

The geometry to check the distance to.

distance double

The distance value to compare.

useSpheroid bool

Whether to use sphere or spheroid distance measurement.

Returns

bool

true if the geometries are less than distance apart.

Remarks

Transform<TGeometry>(DbFunctions, TGeometry, int)

Returns a new geometry with its coordinates transformed to a different spatial reference system. Translates to ST_Transform(geometry, srid).

public static TGeometry Transform<TGeometry>(this DbFunctions _, TGeometry geometry, int srid) where TGeometry : Geometry

Parameters

_ DbFunctions
geometry TGeometry
srid int

Returns

TGeometry

Type Parameters

TGeometry

Remarks