[Gdal-dev] Split a polygon into polygons

Frank Warmerdam warmerdam at pobox.com
Mon Sep 10 09:41:07 EDT 2007


SAEZ Laurent - CETE Méditerr./DI/ETER wrote:
> Hi,
> 
> Is there a way to split a polygon into polygons ?
> I have to make hypsometric areas with some polylines non closed. I would like to split the polygon (or multipolygons) of my departement borders with each polyline.
> I hope I'm a little bit clear...

Laurent,

I am not aware of a mechanism to do this with OGR directly.  You could
write a script that would create a "half the world" polygon with the
cutline as one boundary and then use that polygon to "cut" your target
polygon or multipolygon with the OGRGeometry::Intersection() and
Difference() methods to get the portions on either side of the cutline.

The assumes that your cutlines are such that they can be practically extended
to a great distance and then closed as a polygon.

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    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list