[gdal-dev] Intersect of two shapefiles

Frank Warmerdam warmerdam at pobox.com
Fri Jan 16 09:44:11 EST 2009


nicholas.g.lawrence at mainroads.qld.gov.au wrote:
> I have two shapefiles containing polygons.
> 
> Can OGR derive an intersection of these two layers?

Nick,

The OGR commandline tools do not include anything to do this.  You could
do it using the library or write a script in one of the supporting bindings
languages.  The key method is OGRGeometry::Intersection() which when invoked
on one geometry with another geometry will return a new geometry which is
their intersection.

http://www.gdal.org/ogr/classOGRGeometry.html#202ad4c29487ca046c4a2b055042cb6a

Note that this method depends on GDAL/OGR having been built against the GEOS
geometry library which really does the work.

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