Opened 5 years ago

Closed 4 years ago

#4471 closed defect (fixed)

Intersection between mixed dimensions

Reported by: michaudm Owned by: pramsey
Priority: medium Milestone: PostGIS GEOS
Component: postgis Version: 2.5.x -- EOL
Keywords: Cc:

Description

Intersection between 3D and 2D geometries is generally smart (interpolate z on the 3D geometry). But in the case where the intersection point matches exactly a vertex of one of the geometries, it returns this vertex, either a 2D Point or a 3D Point. As a result, an intersection layer build from the intersection of a 2D layer and a 3D layer may be a mix of 2D and 3D points. But the worst case arises if two geometries have multiple intersections, some matching a 2D vertex and others a 3D one. Here, the process stops with error :

ERROR:  lwcollection_construct: mixed dimension geometries: 0/2 

You can reproduce with the following simple test case :

select ST_Z(ST_Intersection(
	ST_GeomFromText('LINESTRING(0 0, 5 5, 10 10, 20 0)'),
	ST_GeomFromText('LINESTRINGZ(0 10 100, 10 0 100, 15 5 100, 20 10 100)')
))

Change History (5)

comment:1 by robe, 5 years ago

Milestone: PostGIS 2.5.3PostGIS 2.5.4

comment:2 by robe, 5 years ago

I confirmed this is still an issue in PostGIS 2.5.2 and yet to be released 3.0.0alpha4

comment:3 by pramsey, 5 years ago

Milestone: PostGIS 2.5.4PostGIS GEOS

comment:4 by pramsey, 5 years ago

I don't see this result against GEOS 3.8

select st_asewkt(ST_Intersection(
  ST_GeomFromText('LINESTRING(0 0, 5 5, 10 10, 20 0)'),
  ST_GeomFromText('LINESTRINGZ(0 10 100, 10 0 100, 15 5 100, 20 10 100)')
));

          st_asewkt           
------------------------------
 MULTIPOINT(5 5 100,15 5 100)

comment:5 by pramsey, 4 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.