[gdal-dev] Unions shapefiles using ogr
Paul Meems
bontepaarden at gmail.com
Mon Dec 17 05:57:56 PST 2012
Thanks Even.
So this means I need to write my own application using the Union() from
GEOS and I cannot use it on the command line using OGR VRT?
That is OK, I can do that. Using existing utilities on the command line
seemed easier ;)
Thanks,
Paul
2012/12/17 Even Rouault <even.rouault at mines-paris.org>
> Selon Paul Meems <bontepaarden at gmail.com>:
>
> > Hi all,
> >
> > How can I union several shapefiles into one using ogr?
> > I tried using the OGR Virtual Format and created a XML file similar to
> this:
> >
> > <OGRVRTDataSource>
> > <OGRVRTUnionLayer name="unionLayer">
> > <OGRVRTLayer name="source1">
> > <SrcDataSource>source1.shp</SrcDataSource>
> > </OGRVRTLayer>
> > <OGRVRTLayer name="source2">
> > <SrcDataSource>source2.shp</SrcDataSource>
> > </OGRVRTLayer>
> > </OGRVRTUnionLayer>
> > </OGRVRTDataSource>
> >
> > My next step was to call ogr2ogr to created the new file.
> > The above XML merges all shapes instead of performing an union.
>
> This depends on how you define union. In the OGR VRT, the UNION is similar
> to
> the SQL UNION keyword, that is to say that the features of source2 will be
> appended after the features of source1
>
> > How can I do a proper union using ogr?
>
> If you rather need a geometrical union ( ST_Union() ), then you can have a
> look
> at Spatialite (through SQL SQLite dialect for example :
> http://www.gdal.org/ogr/ogr_sql_sqlite.html ), or use the new OGR layer
> algebra
> operations (see
> http://www.gdal.org/ogr/ogr__api_8h.html#ac8edb8696c2b046370e29efdd73787f7)
>
> >
> > Thanks,
> >
> > Paul
> >
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20121217/9b9893a9/attachment.html>
More information about the gdal-dev
mailing list