Opened 13 years ago

Closed 13 years ago

#834 closed defect (fixed)

lw_collection_construct error

Reported by: aperi2007 Owned by: strk
Priority: high Milestone: PostGIS 2.0.0
Component: postgis Version: master
Keywords: Cc:

Description

On a postgres 9.0.3, postgis 2.0.0 trunk on a windows machine, executing this query:

 select
  id,
  st_intersection(b.geom,st_exteriorring(a.geom)),
  b.geom
 from
  table_polygons as a,
  table_linestrings as b
 where
  a.id = b.id
  and
  st_containsproperly(a.geom,b.geom)=false
  and
  st_crosses(b.geom,a.geom)=true
 ;

I'm having these error:

ERROR: lwcollection_construct: mixed dimension geometries: 2/0

I see the geometries of the two tables "table_polygons", and "table_linestrings" are both valid for ST_IsValid().

Change History (8)

comment:1 by strk, 13 years ago

I haven't looked at the code, but the message suggests lwcollectio_construct is confusing topological dimension with coordinate dimension. The query sounds like returning polygons and points…

comment:2 by strk, 13 years ago

Uhm, I was wrong, lwcollection_construct is really talking about ZM flags. Some components of the result have a Z and some others don't. Could be a GEOS bug (intersection returning a collection of items with mixed coordinate dimensions).

Do your polygons or lines or both have a 3rd dimension ? Is the problem "fixed" by forcing them to 2d only ?

comment:3 by aperi2007, 13 years ago

You are reason ! In effect the polygon are 3D and lines are 2D.

 select
  id,
  st_intersection(b.geom,st_exteriorring(st_force_2d(a.geom))),
  b.geom
 from
  table_polygons as a,
  table_linestrings as b
 where
  a.id = b.id
  and
  st_containsproperly(a.geom,b.geom)=false
  and
  st_crosses(b.geom,a.geom)=true
 ;

the error disappeared.

comment:4 by strk, 13 years ago

I wonder what we should do about such cases.

Can see these posibilities:

  • Inflating missing dimensions to uniform toward ceil
  • Dropping exceeding dimensions to uniform toward floor
  • Refuse to apply the overlay to inputs of mixed dimensions

What do you think ?

in reply to:  4 comment:5 by aperi2007, 13 years ago

There isn't the right solution for every situation. I think is better to refuse to apply . So is the user to choice to ceil or to floor.

Replying to strk:

I wonder what we should do about such cases.

Can see these posibilities:

  • Inflating missing dimensions to uniform toward ceil
  • Dropping exceeding dimensions to uniform toward floor
  • Refuse to apply the overlay to inputs of mixed dimensions

What do you think ?

comment:6 by strk, 13 years ago

Owner: changed from pramsey to strk
Priority: mediumhigh
Status: newassigned
Version: 1.5.Xtrunk

Smallest case:

select st_intersection('LINESTRING(0 0,0 10,10 10,10 0)', 'LINESTRING(10 10 4,10 0 5,0 0 5)');

Dropping a coordinate works fine.

comment:7 by strk, 13 years ago

It's a GEOS bug, just filed: http://trac.osgeo.org/geos/ticket/435

comment:8 by strk, 13 years ago

Resolution: fixed
Status: assignedclosed

GEOS-3.2 unaffected. GEOS-3.3.0SVN fixed now.

Note: See TracTickets for help on using tickets.