Skip to content

BUG: ST_Makevalid on Invalid Multipolygon: 'IllegalArgumentException: Overlay input is mixed-dimension' #804

@feyzicaneser

Description

@feyzicaneser

Hi, I'm running into an error 'IllegalArgumentException: Overlay input is mixed-dimension' when calling ST_MakeValid on an invalid Multipolygon geometry.

Steps to reproduce:

set geometry_always_xy = true;

create or replace table faulty_geom as select 
st_geomfromwkb(geom_conus) as geom_conus, 
st_transform(st_geomfromwkb(geom_conus) ,'epsg:5070', 'epsg:4326') as geom_wsg84
from read_parquet('~/Downloads/test_geom_conus.parquet');

select
  ST_GeometryType(geom_conus),
  st_isvalid (geom_conus),
  st_isempty (geom_conus),
  ST_HasZ (geom_conus),
  ST_GeometryType(geom_wsg84),
  st_isvalid (geom_wsg84), -- The geom is invalid
  st_isempty (geom_wsg84),
  ST_HasZ (geom_wsg84),
from
  faulty_geom;

select st_makevalid(geom_wsg84) from faulty_geom ; -- this line fails

Possible Workarounds

  • Now in this case using the buffer trick with the following works:
    `select st_makevalid(st_buffer(geom_wsg84,0)) from faulty_geom'
  • Unnesting the multipolygons into polygons then operating also works
with unnested as (
    select (st_makevalid (unnest(st_dump (geom_wsg84)).geom)) as geom
    from  faulty_geom
  )
select  st_isvalid (ST_Union_Agg (geom))
from  unnested

But I'd like to understand why ST_MakeValid fails in this case, and whether this is a bug that can be fixed. In general i've been dealing with invalid geoms by just calling ST_MakeValid

Fyi this is what the geom looks like , i suspect the extremely thin polygons that look like lines may be causing an issue.
Image

Duckdb Version
Running duckdb 1.5.2 with spatial version dc1996b

test_geom_conus.parquet.zip

'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions