2

I'm using QGIS 3.2.1 (Bonn)

I'm trying to dissolve and create statistics from a group of polygons, but QGIS is not making it. I do not know if I'm missing something or the software has a bug. These are my steps:

1- Select a group of polygons from a layer

enter image description here

2- Use the "Dissolve" tool of the GDAL add-on.

3- Characteristics to dissolve:

Input layer: "Census ratios", check.

Selected features only, check.

Dissolve field, "Dissolve_" (I have created a column with the same attribute "AAA" for all rows for this purpose), check.

Compute stats for attribute, check. Attribute selected: Total population (it is an interger64 field), check.

Now take a look at the console: Dissolve_, SUM(Dissolve_) AS sum, MIN(Dissolve_) AS min, MAX(Dissolve_) AS max, AVG(Dissolve_) AS avg FROM layer_name GROUP BY Dissolve_" -f "ESRI Shapefile"

Is using the Dissolve_ field to calculate the stats. Why? I don't know.

enter image description here

Then go, and the results are crearly wrong. I want to summarize the TOTAL_POPULATION field, not the one used to dissolve the polygons (DISSOLVE_).

enter image description here

Is QGIS failing because of a bug? Or i'm doing something wrong?

Note: I've tried with ArcMap and it goes OK, but i need to work with QGIS.

  • Yep, I'm running into this too... – DWal Sep 20 '18 at 1:56
1

Confirmed, it's an issue with the GDAL plugin. Fix ready to be implemented on 3.4.0 release.

Temporary solution:

Andrea Giudiceandrea wrote: PR https://github.com/qgis/QGIS/pull/7964 submitted for QGIS 3.3.0-master

You can fix your Dissolve algorithm python script by changin line 157 in [QGIS install dir]\apps\qgis\python\plugins\processing\algs\gdal\Dissolve.py

from

statsField = self.parameterAsString(parameters, self.FIELD, context)

to

statsField = self.parameterAsString(parameters, self.STATISTICS_ATTRIBUTE, context)

source: https://issues.qgis.org/issues/19900

Regards!

0

Could you try using a different Field type rather than Integer64? I would use Integer for a field containing a population number or a decimal if they are not whole numbers.

  • Already did it, same result. The console continues using the same incorrect field to calculate the stats ("Dissolve_") : ogr2ogr C:/Users/Facu/AppData/Local/Temp/processing_f783d348c9ed4e5d8b5c31613c1bde55/c2a0ca4a8b35436e8781aa0efec75d9f/OUTPUT.shp path_to_data_file -dialect sqlite -sql "SELECT ST_Union(geometry) AS geometry, Dissolve_, SUM(Dissolve_) AS sum, MIN(Dissolve_) AS min, MAX(Dissolve_) AS max, AVG(Dissolve_) AS avg FROM layer_name GROUP BY Dissolve_" -f "ESRI Shapefile". – facu pedemonte Sep 20 '18 at 0:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.