3

I'm trying to dissolve a shapefile according to a field using Python 2.7.10 and I don't want to use ArcPy.

Is there any way to do this using GDAL/OGR?

Kevin
  • 4,926
  • 2
  • 26
  • 50
moortea
  • 72
  • 1
  • 5

1 Answers1

3

Using the QGIS Processing GDAL Dissolve algorithm and checking the log, you can find something like this:

ogr2ogr /tmp/OUTPUT.shp /tmp/points.shp -nlt PROMOTE_TO_MULTI -dialect sqlite -sql "SELECT ST_Union(geometry) AS geometry, \"DissolveID\" FROM \"points\" GROUP BY \"DissolveID\"" -f "ESRI Shapefile"

Håvard Tveite
  • 3,256
  • 17
  • 32