[gdal-dev] Re: Multipart to singlepart

Frank Warmerdam warmerdam at pobox.com
Mon Dec 6 22:09:34 EST 2010


On 10-12-06 06:13 PM, iomeneandrei wrote:
>
> Hi Frank,
>
> Frank Warmerdam wrote:
>>
>> I am not aware of a way to do this from the commandline utilities.
>>
> could I use the -nlt parameter of ogr2ogr and force POLYGON? If no, what's
> the "power" of -nlt parameter?

Andrea,

Reviewing the ogr2ogr code I see this does trigger a call to forceToPolygon()
though *mostly* it exists to set the type of the created layer.  So, yes,
-nlt polygon with ogr2ogr may well do what you want.

Note that in a format like Shapefile there is no clear distinction
between polygon and multipolygon, so the geometries are reclassified on
read.  So -nlt polygon to a shapefile and then reading it back with ogr
will still result in multipolygons if that is the nature of the rings.

You should have better luck with a more simple features oriented format
like GML.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list