dotConnect for PostgreSQL Documentation
In This Topic
    Choosing Spatial Service
    In This Topic

    This topic is applicable to Entity Framework v5 and v6. For Entity Framework Core, see Spatial Data Support for EF Core.

    A spatial service is used for reading spatial objects from the database, saving objects to database, working with static and instance methods and properties of the DbGeometry and DbGeography classes.

    Spatial Services, Provided by dotConnect for PostgreSQL

    NetTopologySuite

    The NetTopologySuiteSpatialService class is used. It uses NetTopologySuite library.

    Provider value is a NetTopologySuite object, which can be used with third-party libraries that support NetTopologySuite (like SharpMap v1 and higher).

    This service requires NetTopologySuite.dll, GeoAPI.dll, and PowerCollections.dll assemblies from the NetTopologySuite project website.

    Well-Known Text (WKT)

    PgSqlWktSpatialService class is used. Provider value is a WKT representation (string), which can be used with third-party libraries that support WKT.

    Extended Well-Known Text (EWKT)

    PgSqlExtendedWktSpatialService class is used. Provider value is a EWKT (WKT with SRID specified) representation (string), which can be used with third-party libraries that support EWKT.

    Well-Known Binary (WKB)

    PgSqlWkbSpatialService class is used. Provider value is a WKB representation (byte[]), which can be used with third-party libraries that support WKB.

    WKB data is compact, so it generates less traffic than WKT or EWKT.

     

    Spatial Service Comparison

    Spatial service DbGeometry and DbGeography SRID WellKnownValue support1 Stored procedures and functions
    In params and function return value Out / InOut params
    NetTopologySuite Yes2 Yes Yes Yes No
    Well-Known Text (WKT) No3 No4 Yes Yes No
    Extended Well-Known Text (EWKT) No3 Yes Yes Yes No
    Well-Known Binary (WKB) No3 No4 Yes Yes No

    1 DbGeometryWellKnownValue and DbGeographyWellKnownValue data types support (data contract serializable representation of a DbGeometry/DbGeography values).

    2 Most features are supported, but not all of them.

    3 Minimal feature set is supported. See details in the DbGeometry/DbGeography Support in Spatial Services topic.

    4 When persisting data to the database, default SRID values from the GeometryDefaultSrid and GeographyDefaultSrid settings are used. When retrieving SDO_GEOMETRY data from the database, its WKT/WKB representation is retrieved, and SRID is ignored.

    See the Spatial Service Type topic to get more information on specifying which spatial service to use.

    See Also

    Default SRID  | Spatial Service Type  | Area and Distance Units