Intersection tests with curved polygons
Andrea Aime
andrea.aime at geosolutionsgroup.com
Sun Dec 22 07:44:58 PST 2024
Hi Paul,
thanks a lot for following up. Comments inline below.
These are literally CurvePolygon type?
>
The column type is just "geometry(Geometry,3879)", while ST_GeometryType
returns "multisurface" for both.
When doing a ST_AsText instead, you'll get something like:
MULTISURFACE(CURVEPOLYGON(COMPOUNDCURVE((...
for both.
> It’s probably getting caught in our lack of full curve support.
> 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).
>
=# SELECT ogc_fid, ST_Distance(ST_GeomFromText('POINT (25492818
6677399.98)', 3879), geom) FROM testdata;
ogc_fid | st_distance
---------+---------------------
1258 | 0.01234572446598792
12875 | 0
(2 rows)
Indeed, the correct answer, 12875 contains the point, while the other
polygon is close to it.
> Whereas for intersection, the calculation is delegated to GEOS *after
> linearizing the inputs*. In that linearization, could sit the logically
> problem you’re seeing.
>
Let's check with different tolerances... yes, changing the tolerance
changes the result:
=# SELECT ogc_fid FROM testdata WHERE ST_Intersects(ST_CurveToLine(geom,
0.01, 1, 1), ST_GeomFromText('POINT (25492818 6677399.98)', 3879));
ogc_fid
---------
12875
(1 row)
# SELECT ogc_fid FROM testdata WHERE ST_Intersects(ST_CurveToLine(geom,
0.02, 1, 1), ST_GeomFromText('POINT (25492818 6677399.98)', 3879));
ogc_fid
---------
1258
(1 row)
In the immediate future, I guess I could have the GeoTools PostGIS store
use either approach, when knowing curves are involved...
First using && to perform a first rough filter, and then either use either
* ST_Distance equals to 0
* An explicit linearization with a target tolerance (this is an urban
application, so I'm guessing they will need centimeter, if not millimeter,
precision)
.
Is there a clear winner here in terms of performance, or performance of
distance vs linearized intersection is more contextual to the geometries
involved?
Cheers
Andrea
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20241222/6c84c22f/attachment.htm>
More information about the postgis-users
mailing list