6

Considering the following query I expect both geomb and geomc to 3D Intersect with geoma. According to postgis, only geomc intersects. Unfortunately I can't come up with a more simplified polygon as an example, this situation seems largely to depend on the configuration of the polygon.

WITH data AS (
SELECT 
ST_SetSrid(ST_GeometryFromText('
POLYGON Z ((
    122409.416 489410.194 6.64975853832649,
    122404.759 489412.266 3.76021877729423,
    122407.18 489417.708 3.82360012934401,
    122405.377 489418.511 2.70471051793069,
    122406.754 489421.606 2.74081838637221,
    122408.218 489420.954 3.64933000361367,
    122409.263 489423.303 3.67668436361495,
    122407.787 489423.959 2.76102260948305,
    122409.313 489427.389 2.80101513611236,
    122411.091 489426.598 3.90419939305872,
    122411.172 489426.781 3.9061156669998,
    122409.45 489427.547 2.83769648670792,
    122410.905 489430.819 2.87547799988339,
    122412.594 489430.067 3.92357220158512,
    122413.511 489432.131 3.94697470225165,
    122411.723 489432.926 2.83768486408258,
    122413.229 489436.312 2.87694266543155,
    122414.931 489435.555 3.93292998257874,
    122415.345 489436.484 3.94412204281057,
    122420.157 489434.343 6.9298432176791,
    122409.416 489410.194 6.64975853832649
))
'),28992) as geoma,


ST_Extrude(ST_SetSrid(ST_GeometryFromText('
LINESTRING Z (
    122412.982 489429.097 0,
    122414.559 489432.685 0
)
'),28992),0,0,10) as geomb,
ST_Extrude(ST_SetSrid(ST_GeometryFromText('
LINESTRING Z (
    122414.559 489432.685 0,
    122412.756 489433.477 0
)
'),28992),0,0,10) as geomc
)


SELECT 
ST_3DIntersects(geoma,geomb) ab,
ST_3DIntersects(geoma,geomc) ac
FROM data;

Results in: f;t

Would this be a bug in postgis/geos/sfcgal?

Please note: the given geoma above is non-planar because of rounding when exporting to text. In the database it shows ST_IsPlanar(geoma) as true and gives the same results. On top of that, in the database running ST_3DIntersection on geoma vs. geomb and geoma vs. geomc both give a good result. This is not replicable here because of non-planarity.

The situation is perhaps better described in this picture, where geoma is blue, geomb is red and geomc is green. The geometries in the image have been Tesselated for display purpose only.

enter image description here

1
  • 1
    It's a very good question. The 3D stuff is very hard to debug, but I agree with you, both ought to be true, as they intersect in 2d and you have extruded by 10 in the z direction. Commented Aug 23, 2018 at 8:57

1 Answer 1

1

It seems that the bug has been corrected. I had a try and got result true,truewith this PostGIS version:

POSTGIS="3.4.1 3.4.1" [EXTENSION] PGSQL="160" GEOS="3.12.1-CAPI-1.18.1" SFCGAL="SFCGAL 1.5.0, CGAL 5.6, BOOST 1.78.0" PROJ="8.2.1 
1
  • Hadn't looked at this for a loong time but can confirm that in SFCGAL 1.4.1 this is also solved.
    – tilt
    Commented Feb 28 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.