Re: Intersection tests with curved polygons

Andrea Aime <[email protected]>
Newsgroups gmane.comp.gis.postgis
Message-ID <CALHQADWTKH91DiOZR86n70RRusn5RNwYYngybz7SGssMkt35=Q@mail.gmail.com>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.