duckdb / duckdb_spatial

MIT License
489 stars 40 forks source link

How to convert all to 'MULTILINESTRING' #357

Closed aborruso closed 2 months ago

aborruso commented 4 months ago

Hi, when I run

duckdb -c "COPY (SELECT id,ST_AsWKB(geom) geom from ST_READ('input.gpkg')) to 'output.gpkg'  WITH (FORMAT GDAL, DRIVER 'GPKG',SRS 'EPSG:32632',LAYER_NAME 'output',GEOMETRY_TYPE 'MultiLineString')"

I have this error

Invalid Input Error: Expected all geometries to be of type 'MULTILINESTRING', but got one of type 'LINESTRING'

Is there a ST_Multi function to convert all geom to MULTILINESTRING? If yes, how to use it?

If no, is there another duckdb way to do it?

Thank you

Maxxen commented 4 months ago

Hello! Thanks for opening this issue! I can't think of any immediate way to work around this right now, but we should definitely add a ST_Multi function. Ill add it to my todo list.

aborruso commented 2 months ago

Wow, thank you very much @Maxxen !!!