[postgis-users] problem with points in polygon edge

Shaozhong SHI shishaozhong at gmail.com
Mon Mar 14 07:55:44 PDT 2022


On Mon, 14 Mar 2022 at 14:42, Greg Troxel <gdt at lexort.com> wrote:

>
> Gustavo Martinez <gmpuljak at yahoo.com.ar> writes:
>
> > Hi all,
> >
> > I am working with fishing vessels positions. I have millions of
> > points, and when doing some analysis I need to do some intersections
> > with polygons.
> >
> > All the database is on EPSG 4326 (Lat Long)
> >
> > I've noticed some problems when the points are on the edges of the
> > polygons. When I use ST_Within I lose the points on the edges, while
> > when using ST_Intersects those points get counted twice.
>
> I would suggest figuring out what is wrong with the queries that ought
> to make sense and fixing that instead of trying to code a function that
> behaves like that and then optimizing that funciton.
>
>
> You say "lose points on the edge", but you did not post your query and
> you did not post a sample point that is mishandled.
>
> Do you mean something like a pseudo-square from say 40-41N, 20-21E and a
> point that is 40.5N 20E and wanting that to be included in ST_Within?
> If you don't mean that please explain precisely.
>
> I also don't understand "with ST_Intersects I get duplicates", but again
> you didn't post your query or sample data.
>
> It seems like if you want to select  all vessel points within some
> polyon (including points that are on the edge), ST_Intersects should be
> want you want.
>
>
> I would also wonder why you care about points that are strictly on the
> polygon.  First, boats are not points, but I am guessing you have "Boat
> Reference Position", perhaps implicitly a GPS antenna.
>
> All measurements have error, and thus for any actual boat
> position near the polygon edge, a recorded position could be inside or
> outside.  So worrying that a position exactly on the line numerically --
> which seems pretty unlikely with real data of high -- is not something
> that I understand.
>
> Hope this helps,
> Greg
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users


Hi, Greg,

This is interesting.  A detector function should be developed so that we
can find such points and their locations.

Regards,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20220314/0f167792/attachment.html>


More information about the postgis-users mailing list