[postgis-users] 3D intersects and 2D doesn't. Is this normal?

Paul Ramsey pramsey at cleverelephant.ca
Fri Feb 28 12:33:34 PST 2020


Different code lines. The 3D function is evaluated via the 3d distance calculation internal to postgis, with a tolerance of 0. The 2D function is evaluated in GEOS.
Your two lines are in fact very very very almost intersecting, but not quite. If I apply ST_Astext() to them before running your ops, I get this result:

-[ RECORD 1 ]---+-----------------------
st_3dintersects | f
st_intersects   | f
st_distance     | 2.9103830456733704e-10
st_3ddistance   | 2.9103830456733704e-10

So they are close enough to being intersecting that slightly different comparisons in a different order get different answers. Discrete math is fun.

P


> On Feb 28, 2020, at 4:45 AM, Alexandre Silva <amsilva at infoportugal.impresa.pt> wrote:
> 
> Hello, i'm having a problem that i find strange with intersecting geometries. I have two geometries, they intersect in 3d but not in 2d. How is this possible?
> Here's a sample:
> 
> with x as (
> select 
> st_geomfromewkb('\x01020000a0b30e000002000000947bdfddb6b3e6c0563ada3e089204410000000000000000957bdfdd36b1e6c060dcd03e089204410000000000000000') as broken_geom,
> st_geomfromewkb('\x0102000020b30e00000e000000b34ffa12d0b2e6c099d9d63e0892044135ff664cd8b2e6c0045b0799079204419a71eb3de1b2e6c01a83fdfe069204415b5ca842eab2e6c0930530690692044140271ba8f3b2e6c02d065ee405920441de0afec7fcb2e6c0fca16e8e0592044185ae750a06b3e6c073a9671c0592044169af95520fb3e6c0134c1ed40492044173cde2c218b3e6c0a892c48604920441f8f7d21f22b3e6c0db66bf6b04920441d13e0c902bb3e6c0f1384f4004920441e8ae92dc34b3e6c0388f5e3d0492044120cb297f3eb3e6c02ff6c54204920441cd9519fe47b3e6c0437fde4904920441') as blade
>  )
>  select st_3dintersects(broken_geom, blade), st_intersects(broken_geom, blade) from x;
> NOTICE:  One or both of the geometries is missing z-value. The unknown z-value will be regarded as "any value"
>  st_3dintersects | st_intersects 
> -----------------+---------------
>  t               | f
> (1 row)
> 
> any ideas?
> 
> Best regards,
> Alexandre Silva
> 
> 
> 
> 
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users



More information about the postgis-users mailing list