[gdal-dev] Multipart to singlepart

Frank Warmerdam warmerdam at pobox.com
Mon Dec 6 14:03:35 EST 2010


On 10-12-06 06:54 AM, iomeneandrei wrote:
>
> Hi all,
> is there in OGR a command that I can use to convert multipart polygons in
> singleparts?

Andrea,

At the API or scripting level there is the OGRGeometryFactory::forceToPolygon()
method to try and convert a multipolygon to a simple polygon.  I am not
aware of a way to do this from the commandline utilities.

/************************************************************************/
/*                           forceToPolygon()                           */
/************************************************************************/

/**
  * \brief Convert to polygon.
  *
  * Tries to force the provided geometry to be a polygon.  Currently
  * this just effects a change on multipolygons.  The passed in geometry is
  * consumed and a new one returned (or potentially the same one).
  *
  * @param poGeom the input geometry - ownership is passed to the method.
  * @return new geometry.
  */

OGRGeometry *OGRGeometryFactory::forceToPolygon( OGRGeometry *poGeom )

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