This topic is applicable to Entity Framework v5 and v6. For Entity Framework Core, see Spatial Data Support for EF Core.
The following table demonstrates which properties and methods of DbGeometry and DbGeography are supported by available spatial services:
Method/Property | Spatial service | |||||
---|---|---|---|---|---|---|
Name | DbGeometry | DbGeography | NetTopologySuite1 | WKT | EWKT | WKB |
Instance Properties | ||||||
Area | √ | √ | ||||
Boundary | √ | – | ||||
Centroid | √ | – | ||||
ConvexHull | √ | – | ||||
CoordinateSystemId | √ | √ | 2 | 2 | ||
Dimension | √ | √ | ||||
ElementCount | √ | √ | ||||
Elevation | √ | √ | ||||
EndPoint | √ | √ | ||||
Envelope | √ | – | ||||
ExteriorRing | √ | – | ||||
InteriorRingCount | √ | – | ||||
IsClosed | √ | √ | ||||
IsEmpty | √ | √ | ||||
IsRing | √ | – | ||||
IsSimple | √ | – | ||||
IsValid | √ | – | ||||
Latitude | – | √ | ||||
Length | √ | √ | ||||
Longitude | – | √ | ||||
Measure | √ | √ | ||||
PointCount | √ | √ | ||||
PointOnSurface | √ | – | ||||
ProviderValue | √ | √ | ||||
SpatialTypeName | √ | √ | ||||
StartPoint | √ | √ | ||||
WellKnownValue | √ | √ | ||||
XCoordinate | √ | – | ||||
YCoordinate | √ | – | ||||
Instance Methods | ||||||
AsBinary | √ | √ | ||||
AsGml | √ | √ | ||||
StartPoint | √ | √ | ||||
AsText | √ | √ | ||||
Buffer | √ | √ | ||||
Contains | √ | – | ||||
Crosses | √ | – | ||||
Difference | √ | √ | ||||
Disjoint | √ | √ | ||||
Distance | √ | √ | ||||
ElementAt | √ | √ | ||||
InteriorRingAt | √ | – | ||||
Intersection | √ | √ | ||||
Intersects | √ | √ | ||||
Overlaps | √ | – | ||||
PointAt | √ | √ | ||||
Relate | √ | – | ||||
SpatialEquals | √ | √ | ||||
SymmetricDifference | √ | √ | ||||
Touches | √ | – | ||||
Union | √ | √ | ||||
Within | √ | – | ||||
Static Methods | ||||||
FromBinary(Byte[]) | √ | √ | ||||
FromBinary(Byte[], Int32) | √ | √ | ||||
FromGml(String) | √ | √ | ||||
FromGml(String, Int32) | √ | √ | ||||
FromText(String) | √ | √ | ||||
FromText(String, Int32) | √ | √ | ||||
GeometryCollectionFromBinary | √ | √ | ||||
GeometryCollectionFromText | √ | √ | ||||
LineFromBinary | √ | √ | ||||
LineFromText | √ | √ | ||||
MultiLineFromBinary | √ | √ | ||||
MultiLineFromText | √ | √ | ||||
MultiPointFromBinary | √ | √ | ||||
MultiPointFromText | √ | √ | ||||
MultiPolygonFromBinary | √ | √ | ||||
MultiPolygonFromText | √ | √ | ||||
PointFromBinary | √ | √ | ||||
PointFromText | √ | √ | ||||
PolygonFromBinary | √ | √ | ||||
PolygonFromText | √ | √ |
1 The mark in the NetTopologySuite column does not mean the feature is completely supported. It means that NetTopologySuite declares support for it, and it is used by our NetTopologySuite spatial service. However, this feature may not be implemented for some types and cases in the NetTopologySuite library.
2 WKT and WKB spatial services always return config.SpatialOptions.GeometryDefaultSrid for DbGeometry and config.SpatialOptions.GeographyDefaultSrid for DbGeography as CoordinateSystemId.