简体   繁体   中英

Getting started with npgsql, Entity Framework and postgis

I'm trying to get started with npgsql, particularly the PostGIS support, but am struggling to find documentation or examples online.

I'm working with C# ASP.NET and ideally I would like to use Entity Framework style GIS queries. Something like this pseudocode:

var pointsInPolygon = db.points.Where(i => polygon.Contains(i.point));

var pointsInRadius = db.points.Where(i => CreateCircle(point, radius).Contains(i.point));

Is this kind of functionality possible with a syntax like I have posted above? If not could you please indicate how best to go about achieving it?

Edit: For example, how could I utilise an ST_Within query in the context of the entity framework.

Although Npgsql does support PostGIS well, the Entity Framework 6 driver does not yet map DbGeography/DbGeometry etc. to PostGIS. See the following issue: https://github.com/npgsql/EntityFramework6.Npgsql/issues/18

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM