Home > Net >  EFCORE NetTopologySuite problem
EFCORE NetTopologySuite problem

Time:11-20

X80004005 Npgsql. PostgresException (0) : 42883: function st_distance (point, geography) does not exist


Nuget:Npgsql.EntityFrameworkCore.PostgreSQL.Net TopologySuite

The Entity
 
Using NetTopologySuite. Geometries';
Public break {
Public string Name {get; The set; }
Public string {feel get; The set; }
Public string Phone {get; The set; }
Public Point Location {get; The set; }
}

Dbcontext
 
Protected override void OnConfiguring (DbContextOptionsBuilder builder)
{
Builder. UseNpgsql (" Host=localhost; The Database=test; The Username=npgsql_tests; Password=npgsql_tests ",
O=& gt; O.U seNetTopologySuite ());
}
Protected override void OnModelCreating (ModelBuilder builder)
{
Postgis builder. HasPostgresExtension (" ");
}

Query the location in the PGSQL type: point value "(106.2889702, 31.2832916)"
 
Var currentLocation=new Point (106.2972496, 31.2669647) {4326} SRID=;
Var data=https://bbs.csdn.net/topics/_dbContext.Merchant.Where (x=> x.L ocation. Short (currentLocation) <100). ToList ();

The following error: PostGIS installed



CodePudding user response:

The function st_distance does not exist, the database version does not support this function

CodePudding user response:

PostGIS installed

CodePudding user response:

Error obviously
The function the st_distance (point, geography) does not exist

CodePudding user response:

refer to the third floor is nu month god reply:
error obviously
The function the st_distance (point, geography) does not exist

I can use the st_distance use native SQL
  • Related