Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a problem with group same data to count it.

For example, i want to group same code to one and count them.

I can do it when i use MapInfo (Pic 1) but i can't in QGIS. (Pic 2: i can classify data and count it but can't get them in attribute table.)

enter image description here

share|improve this question

I suggest you to install Group Stats plugin. Here is a quick tutorial: group stat tutorial

  1. Search for the Group Stats icon
  2. Select the layer in which you have the Codes
  3. Select the attribute (in your case Code)
  4. Click on Calculate

The Count will appear. If you go to preferences you should be able to select only Count avoiding the other parameters to be displayed (this is not my case...). Remember before click Save button you have to select the fields you want to add to your .csv: hold on Shift for do that. Here is a more advanced tutorial written by Anita Graser.

share|improve this answer
Thanks! I'll try – Seren Sep 9 '13 at 8:52
You're welcome! Have a look to this question too. I hope to see more from you! Bye! – G M Sep 9 '13 at 9:22

This was the best result on Google I could find, but the screenshot tutorial by G M is out of date and it took me a while to work out how to use the plugin.

  1. Once installed, Load the Group Stats control panel from the "Vector" menu.
  2. Select the layer of interest.
  3. From the fields list, drag the field of interest into the "rows" box.
  4. Now drag the same field into the "value" box.
  5. In the fields list are also some functions, drag "count" into the "value" box (below the field you put in there).
  6. Click "calculate" and a table will appear on the left.
  7. You can sort by the count if you wish, click the column label.

How this helps other people.

share|improve this answer

you could also use Qspatialite in QGIS. The SQL window is just as Mapinfo one. Up to you after to make your SQL request with a groupby command on the wanted column.

share|improve this answer

With the new virtual layer you can now use SQL on any layer in QGIS, for example the airport Shapefile from the QGIS sample data:

enter image description here

To count the number of airports by USE type and compute the average elevation use:

enter image description here

The results are loaded as a new layer:

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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