Opened 7 years ago

Last modified 6 years ago

#3771 new defect

MultiLineStringZ not working when as first argument for ST_Intersection

Reported by: WaltDixie Owned by: strk
Priority: medium Milestone: PostGIS Fund Me
Component: postgis Version: 2.2.x
Keywords: intersection, multilinestring, 2.5D Cc:

Description

On POSTGIS 2.2, using geos, multilinestringZ aren't handled as expected when used as first argument in ST_Intersection.

Compare sect1bad to sect1best, sect2bad to sect2best in the following query:

SELECT li, ST_NumGeometries(geoma),ST_NumGeometries(geomb), 		
ST_AsText(ST_Intersection(ST_GeometryN(geoma,li),ST_Force3D(ST_Force2D(geomb)))) as sect1best,		
ST_AsText(ST_intersection(geoma,ST_Force3D(ST_Force2D(geomb)))) as sect1bad, 	 	
 ST_AsText(ST_Intersection(ST_Force3D(ST_Force2D(ST_GeometryN(geoma,li))),geomb)) as sect2best	,
 ST_AsText(ST_Intersection(ST_Force3D(ST_Force2D(geoma)),geomb)) as sect2bad		
  
FROM 		
( SELECT		
ST_GeomFromText('MULTILINESTRING Z ((0 0 10,0 1 11),(0 1 11, 0 10 20))') as geoma,		
ST_GeomFromText('MULTILINESTRING Z ((0 0 5,0 2 9),(0 2 9, 0 3 11))') as geomb		
) data		
CROSS JOIN LATERAL generate_series(1,ST_NumGeometries(geoma)) li(li)

GEOS 3D intersection should lead to the average Z-coordinate at each node of the intersection. This is correctly handled in the 'best' cases, where the first argument is split into its component LineStringZ segments. However, in the 'bad' cases, where the first argument is a MultiLineStringZ, the 'inner' node does not have the average Z-coordinate but rather retains its original value. Clearly this functionality can be avoided by splitting the first argument in its component geometries, but somehow this is not handled by default by the function.

Change History (6)

comment:1 by robe, 7 years ago

Milestone: Management 2.0PostGIS 2.2.6

comment:2 by robe, 7 years ago

Owner: changed from pramsey to strk

strk you think there is much we can do about this or just a limitation of GEOS in 3d, in which case we should just mark as won't fix.

comment:3 by strk, 7 years ago

I don't really see why GEOS should not handle the multilinestringZ, so this sounds like a bug to me. Dunno if it's in PostGIS (not passing 3D to GEOS) or GEOS. Can you provide a GEOS testcase ?

comment:4 by robe, 7 years ago

Milestone: PostGIS 2.2.6PostGIS 2.3.4

comment:5 by pramsey, 7 years ago

Milestone: PostGIS 2.3.4PostGIS 2.3.5

comment:6 by robe, 6 years ago

Milestone: PostGIS 2.3.5PostGIS Fund Me
Note: See TracTickets for help on using tickets.