[gdal-dev] Dissolve shapefile using GDAL/OGR

Hugo Benicio hbobenicio at gmail.com
Tue Feb 26 09:09:43 PST 2013


*Andreas Oxenstierna,*
Thanks for your answer, I'll take a look on PostGIS to see if it can be
useful in my case, but I probably don't need to use a DBMS.

*Jukka Rahkonen,*
Thanks for your answer.
I've tried that command but I'm probably missing Spatialite. Maybe I need
to recompile my GDAL to use it.
That's the output:

ogrinfo WasaReduzidoFinal.shp -dialect sqlite -sql "select
ST_union(Geometry), Lan_ID from WasaReduzidoFinal GROUP BY Lan_ID"
INFO: Open of `WasaReduzidoFinal.shp'
      using driver `ESRI Shapefile' successful.
ERROR 1: Undefined function 'ST_union' used.

*Peter Halls,*
Thanks for your answer.*
*
This is probably what I'm intended to do.
My shapefiles are constructed among a lot of consecutive intersections in a
way that polygons would never overlap, so I'm ok with that.

Thank you all for your quick answers!

Best Regards,
Hugo Benício.


On Tue, Feb 26, 2013 at 11:16 AM, Jukka Rahkonen
<jukka.rahkonen at mmmtike.fi>wrote:

> Hugo Benicio <hbobenicio <at> gmail.com> writes:
>
> >
> > Hi!
> > So, My question is pretty simple.
> > I'm developing a software in C++ that uses GDAL/OGR library to handle
> geoprocessing computations. What I need to do now is to dissolve a
> shapefile by
> a column (similiar to the Quantum GIS tool "Vector > Geoprocessing Tools >
> Dissolve").
> > Does GDAL/OGR already support this operation (or eases this somehow)? Do
> I
> have to implement it by myself? Do I need to use another library to easily
> acomplish this task? (GRASS?).
>
> Sure at least to some extent. The following command is utilising
> Spatialite SQL
> and it is building unions by attribure "YTA". I suppose GDAL needs to be
> build
> with Spatialite and Spatialite with GEOS. I tested with GDAL-dev Windows
> build
> from gisinternals.com.
>
> Test with ogrinfo
>
> C:\GDAL_dev>ogrinfo  union_test.shp -dialect sqlite
> -sql "select ST_union(Geometry),YTA from union_test GROUP BY YTA"
>
> Conversion into shapefile
>
> C:\GDAL_dev>ogr2ogr -f "ESRI Shapefile" union.shp union_test.shp -dialect
> sqlite
> -sql "select ST_union(Geometry),YTA from union_test GROUP BY YTA"
>
>
> -Jukka Rahkonen-
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130226/1096dfa5/attachment-0001.html>


More information about the gdal-dev mailing list