I have a table with Geometry column using EF Core spatial data and Npgsql.EntityFrameworkCore.PostgreSQL provider
class City
{
public int ID { get; set; }
public string CityName { get; set; }
public Point Location { get; set; }
}
I used to filter by distance this way
Point myLocation = new Point(longitude, latitude)
{
SRID = 4326
};
cities = db.Cities.Where(a => a.Location.ProjectTo(2855).Distance(myLocation.ProjectTo(2855)) <= radiusMeters);
After update i got following error:
The LINQ expression 'DbSet()...' could not be translated. Additional information: Translation of method 'App.GeometryExtensions.ProjectTo' failed.
It works without using ProjectTo() but counts by degrees. Is there a way to translate this query for work with meters again?