Skip to content

Spatial Types

Simon Hughes edited this page Mar 20, 2026 · 12 revisions

Spatial Types

Configuration

Enable spatial types (default):

Settings.DisableGeographyTypes = false;

Disable spatial types:

Settings.DisableGeographyTypes = true;

If DisableGeographyTypes = true and a stored procedure contains spatial parameters or return types, that stored procedure will not be generated.

EF Core 8, 9, and 10

Maps to NetTopologySuite.Geometries.Point / Geometry.

Install NuGet:

Install-Package Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite

Enable in optionsBuilder:

optionsBuilder.UseSqlServer(@"your_connection_string",
    x => x.UseNetTopologySuite());

Or with DI:

services.AddDbContext<MyDbContext>(options =>
    options.UseSqlServer(connectionString, x => x.UseNetTopologySuite()));

EF 6

Maps to System.Data.Entity.Spatial.DbGeography / DbGeometry. No additional NuGet packages are required.

References

Clone this wiki locally