<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Aptos;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:12.0pt;
font-family:"Aptos",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Aptos",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:478689229;
mso-list-template-ids:-720046178;}
@list l0:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:1.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:1.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:2.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:2.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:3.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:3.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:4.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:4.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1
{mso-list-id:1239438361;
mso-list-template-ids:-130232668;}
@list l1:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:1.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";}
@list l1:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:1.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:2.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:2.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:3.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:3.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:4.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:4.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l2
{mso-list-id:1678195254;
mso-list-template-ids:-1265352818;}
@list l2:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l2:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:1.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";}
@list l2:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:1.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l2:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:2.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l2:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:2.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l2:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:3.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l2:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:3.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l2:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:4.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l2:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:4.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l3
{mso-list-id:1819687740;
mso-list-template-ids:878365398;}
@list l3:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l3:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:1.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";}
@list l3:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:1.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l3:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:2.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l3:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:2.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l3:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:3.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l3:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:3.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l3:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:4.0in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l3:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:4.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt'>Why isn’t ST_DWithin being used here?<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>I thought we had native curve distance checking with ST_DWithin as well.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'> Paul Ramsey <pramsey@cleverelephant.ca> <br><b>Sent:</b> Tuesday, January 7, 2025 1:37 PM<br><b>To:</b> Andrea Aime <andrea.aime@geosolutionsgroup.com><br><b>Cc:</b> PostGIS Users Discussion <postgis-users@lists.osgeo.org><br><b>Subject:</b> Re: Intersection tests with curved polygons<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>I’m not 100% sure this is apples and apples?<o:p></o:p></p></div><div><div><p class=MsoNormal><br><br><o:p></o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal>On Jan 7, 2025, at 2:55<span style='font-family:"Arial",sans-serif'> </span>AM, Andrea Aime <<a href="mailto:andrea.aime@geosolutionsgroup.com">andrea.aime@geosolutionsgroup.com</a>> wrote:<o:p></o:p></p></div><div><div><div><p class=MsoNormal> testing 3 scenarios:<o:p></o:p></p></div><div><ul type=disc><li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0 level1 lfo1'>The current query using ST_Intersection as is (returns 2 polygons, wrong result but I'm treating it as the baseline)<o:p></o:p></li></ul></div></div></div></blockquote><div><p class=MsoNormal>ST_Intersection() is an expensive operation, constructing new geometry. ST_Intersects() is a cheaper operation, returning true/false.<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><div><div><ul type=disc><li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l3 level1 lfo2'>Using && + ST_Distance<o:p></o:p></li></ul></div></div></div></blockquote><div><p class=MsoNormal>ST_Distance() is cheaper than ST_Intersection(), and similar to ST_Intersects() in how it calculates an answer.<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><div><div><ul type=disc><li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l2 level1 lfo3'>Using && + linearized intersection, with a precision good enough to get the correct result (0.01 meters)<o:p></o:p></li></ul></div></div></div></blockquote><div><p class=MsoNormal>Still using Intersection() so on an expensive path.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Some things to note in general:<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>- ST_Intersection() will always delegate to GEOS and if handed curves will linearize them first. Delegating to GEOS does have some fixed overheads, a full copy of the geometry is made, and GEOS set up.<o:p></o:p></p></div><div><p class=MsoNormal>- ST_Intersects() will sometimes delegate to GEOS, one of those cases being handed a curve polygon. Which will again coast you linearization and a full copy.<o:p></o:p></p></div><div><p class=MsoNormal>- Finer linearization will naturally result in more segments and more processing cost.<o:p></o:p></p></div><div><p class=MsoNormal>- ST_Distance() with native curve support trades the expense of some extra trig doing edge/arc calculations for avoiding the trip to GEOS and processing a much smaller number of edges than the linearized path.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><div><div><div><p class=MsoNormal>I find the results surprsing:<o:p></o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>> pgbench -U cite helsinki -f baseline.sql -c 32 -t 2000<br>tps = 10227.810087 ((without initial connection time)<br><br>> pgbench -U cite helsinki -f distance.sql -c 32 -t 2000<br>tps = 19989.627257 (without initial connection time)<br><br>> pgbench -U cite helsinki -f linearized.sql -c 32 -t 2000<br>tps = 8984.594159 (without initial connection time)<br><br>So... testing with the distance is twice as fast as the other options? Wow, have we been doing intersection tests wrong all this time? ROFL<o:p></o:p></p></div><div><p class=MsoNormal>Other possible ideas:<o:p></o:p></p></div><div><ul type=disc><li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l1 level1 lfo4'>There is something specific to having curves in the mix, and having to pay the cost of linearization makes distance competitive?<o:p></o:p></li><li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l1 level1 lfo4'>The specific dataset is playing an important role in the result<o:p></o:p></li></ul></div></div></div></blockquote><div><p class=MsoNormal>I am not, in general, surprised at your results, knowing the different code paths your tests could be running through.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>P.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal><br><br><o:p></o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><div><div><p class=MsoNormal>Ah, since there seems to be a real issue, I've also opened a ticket in trac: <a href="https://trac.osgeo.org/postgis/ticket/5832#ticket">https://trac.osgeo.org/postgis/ticket/5832#ticket</a><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><div><div><div><p class=MsoNormal><span style='font-family:"Arial",sans-serif;color:#222222'>Regards,</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Arial",sans-serif;color:#222222'>Andrea Aime</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Arial",sans-serif;color:#222222'><br><br></span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Arial",sans-serif;color:#222222'>==</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Arial",sans-serif;color:#222222'><br>GeoServer Professional Services from the experts!</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Arial",sans-serif;color:#222222'>Visit </span><a href="http://bit.ly/gs-services-us" target="_blank"><span style='font-family:"Arial",sans-serif;color:#1155CC'>http://bit.ly/gs-services-us</span></a><span style='font-family:"Arial",sans-serif;color:#222222'> for more information.<br><br><br></span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Arial",sans-serif;color:#222222'>==<br><br>Ing. Andrea Aime <br>@geowolf<br>Technical Lead<br><br><br></span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Arial",sans-serif;color:#222222'>GeoSolutions Group<br>phone: +39 0584 962313</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Arial",sans-serif;color:#222222'>fax: +39 0584 1660272</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Arial",sans-serif;color:#222222'>mob: +39 339 8844549</span><o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal><a href="https://www.geosolutionsgroup.com/" target="_blank"><span style='font-family:"Arial",sans-serif;color:#1155CC'>https://www.geosolutionsgroup.com/</span></a><o:p></o:p></p></div><div><p class=MsoNormal><a href="http://twitter.com/geosolutions_it" target="_blank"><span style='font-family:"Arial",sans-serif;color:#1155CC'>http://twitter.com/geosolutions_it</span></a><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Arial",sans-serif;color:#222222'>-------------------------------------------------------</span><o:p></o:p></p></div><p class=MsoNormal><br><span style='font-family:"Arial",sans-serif'>Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.<br><br>This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail</span><o:p></o:p></p></div></div></div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>On Sun, Dec 22, 2024 at 4:44<span style='font-family:"Arial",sans-serif'> </span>PM Andrea Aime <<a href="mailto:andrea.aime@geosolutionsgroup.com">andrea.aime@geosolutionsgroup.com</a>> wrote:<o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><div><div><p class=MsoNormal>Hi Paul,<o:p></o:p></p></div><div><p class=MsoNormal>thanks a lot for following up. Comments inline below.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div></div><div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><p class=MsoNormal>These are literally CurvePolygon type? <o:p></o:p></p></div></blockquote><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>The column type is just "geometry(Geometry,3879)", while ST_GeometryType returns "multisurface" for both.<o:p></o:p></p></div><div><p class=MsoNormal>When doing a ST_AsText instead, you'll get something like:<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>MULTISURFACE(CURVEPOLYGON(COMPOUNDCURVE((...<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>for both.<o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><p class=MsoNormal>It’s probably getting caught in our lack of full curve support.<o:p></o:p></p><div><p class=MsoNormal>I would be interested in the ST_Distance between the point and those two CurvePolygons. (Because, for distance, we have a postgis-native implementation that supports curves). <o:p></o:p></p></div></div></blockquote><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>=# SELECT ogc_fid, ST_Distance(ST_GeomFromText('POINT (25492818 6677399.98)', 3879), geom) FROM testdata;<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal> ogc_fid | st_distance <br>---------+---------------------<br> 1258 | 0.01234572446598792<br> 12875 | 0<br>(2 rows)<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Indeed, the correct answer, 12875 contains the point, while the other polygon is close to it.<o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><div><p class=MsoNormal>Whereas for intersection, the calculation is delegated to GEOS *after linearizing the inputs*. In that linearization, could sit the logically problem you’re seeing.<o:p></o:p></p></div></div></blockquote><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Let's check with different tolerances... yes, changing the tolerance changes the result:<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>=# SELECT ogc_fid FROM testdata WHERE ST_Intersects(ST_CurveToLine(geom, 0.01, 1, 1), ST_GeomFromText('POINT (25492818 6677399.98)', 3879));<br> ogc_fid <br>---------<br> 12875<br>(1 row)<br><br># SELECT ogc_fid FROM testdata WHERE ST_Intersects(ST_CurveToLine(geom, 0.02, 1, 1), ST_GeomFromText('POINT (25492818 6677399.98)', 3879));<br> ogc_fid <br>---------<br> 1258<br>(1 row)<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>In the immediate future, I guess I could have the GeoTools PostGIS store use either approach, when knowing curves are involved... <o:p></o:p></p></div><div><p class=MsoNormal>First using && to perform a first rough filter, and then either use either<o:p></o:p></p></div><div><p class=MsoNormal>* ST_Distance equals to 0<o:p></o:p></p></div><div><p class=MsoNormal>* An explicit linearization with a target tolerance (this is an urban application, so I'm guessing they will need centimeter, if not millimeter, precision)<o:p></o:p></p></div><div><p class=MsoNormal>.<o:p></o:p></p></div><div><p class=MsoNormal>Is there a clear winner here in terms of performance, or performance of distance vs linearized intersection is more contextual to the geometries involved?<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Cheers<o:p></o:p></p></div><div><p class=MsoNormal>Andrea<o:p></o:p></p></div></div></div></blockquote></div></div></blockquote></div><p class=MsoNormal><o:p> </o:p></p></div></div></div></body></html>