<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 14 Mar 2022 at 14:42, Greg Troxel <<a href="mailto:gdt@lexort.com">gdt@lexort.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Gustavo Martinez <<a href="mailto:gmpuljak@yahoo.com.ar" target="_blank">gmpuljak@yahoo.com.ar</a>> writes:<br>
<br>
> Hi all,<br>
><br>
> I am working with fishing vessels positions. I have millions of<br>
> points, and when doing some analysis I need to do some intersections<br>
> with polygons.<br>
><br>
> All the database is on EPSG 4326 (Lat Long)<br>
><br>
> I've noticed some problems when the points are on the edges of the<br>
> polygons. When I use ST_Within I lose the points on the edges, while<br>
> when using ST_Intersects those points get counted twice.<br>
<br>
I would suggest figuring out what is wrong with the queries that ought<br>
to make sense and fixing that instead of trying to code a function that<br>
behaves like that and then optimizing that funciton.<br>
<br>
<br>
You say "lose points on the edge", but you did not post your query and<br>
you did not post a sample point that is mishandled.<br>
<br>
Do you mean something like a pseudo-square from say 40-41N, 20-21E and a<br>
point that is 40.5N 20E and wanting that to be included in ST_Within?<br>
If you don't mean that please explain precisely.<br>
<br>
I also don't understand "with ST_Intersects I get duplicates", but again<br>
you didn't post your query or sample data.<br>
<br>
It seems like if you want to select  all vessel points within some<br>
polyon (including points that are on the edge), ST_Intersects should be<br>
want you want.<br>
<br>
<br>
I would also wonder why you care about points that are strictly on the<br>
polygon.  First, boats are not points, but I am guessing you have "Boat<br>
Reference Position", perhaps implicitly a GPS antenna.<br>
<br>
All measurements have error, and thus for any actual boat<br>
position near the polygon edge, a recorded position could be inside or<br>
outside.  So worrying that a position exactly on the line numerically --<br>
which seems pretty unlikely with real data of high -- is not something<br>
that I understand.<br>
<br>
Hope this helps,<br>
Greg<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a></blockquote><div><br></div><div>Hi, Greg,</div><div><br></div><div>This is interesting.  A detector function should be developed so that we can find such points and their locations.</div><div><br></div><div>Regards,</div><div><br></div><div>David </div></div></div>