[gdal-dev] ogr2ogr to convert one CSV row of MULTIPOLYGON to many CSV rows of POLYGON
jratike80
jukka.rahkonen at maanmittauslaitos.fi
Fri Oct 11 06:09:31 PDT 2019
Here is a partial solution or workaround
Take this as input
id,wkt
1,"MULTIPOLYGON ((( 296 643, 623 660, 531 484, 349 507, 296 643 )), (( 681
635, 895 588, 632 432, 681 635 )))"
Run this
ogr2ogr -f csv -lco geometry=as_wkt -explodecollections wkt_expl.csv wkt.csv
Get this result
WKT,id,wkt
"POLYGON ((296 643,623 660,531 484,349 507,296 643))","1","MULTIPOLYGON (((
296 643, 623 660, 531 484, 349 507, 296 643 )), (( 681 635, 895 588, 632
432, 681 635 )))"
"POLYGON ((681 635,895 588,632 432,681 635))","1","MULTIPOLYGON ((( 296 643,
623 660, 531 484, 349 507, 296 643 )), (( 681 635, 895 588, 632 432, 681 635
)))"
So, the original multigeometry is included in both lines but an additional
WKT columns contains the exploded polygons. Without -lco geometry=as_wkt
just the the multipolygon geometry is written into both lines.
id,wkt
"1","MULTIPOLYGON ((( 296 643, 623 660, 531 484, 349 507, 296 643 )), (( 681
635, 895 588, 632 432, 681 635 )))"
"1","MULTIPOLYGON ((( 296 643, 623 660, 531 484, 349 507, 296 643 )), (( 681
635, 895 588, 632 432, 681 635 )))"
So something happened but not exactly what I would have guessed. Use case is
a bit special but perhaps this is buggy behavior.
-Jukka Rahkonen-
jratike80 wrote
> Hi,
>
> Please provide some test data and explain in details what did you try.
> Spending some time for making an answerable question would certainly be
> the
> best way for getting fast and usable help.
>
> -Jukka Rahkonen-
--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
More information about the gdal-dev
mailing list