1

I have a database with each and every death in a country, each row in the database has a GEO_REFERENCE tag constructed by the concatenation of a code given to every division and subdivision instead of a GPS point, looking as follows:

 STATE_NAME    |  STATE_CODE  |    MUN_NAME    |  MUN_NAME  |  GEO_REF
Name of State  |      01      |    City Name   |   0001     |  010001

Already having a layer with the divisions and subdivisions named according to that GEO_REF code, Can it be counted how many times there has been a death at every one of this GEO_REF, in order to map it? Or should the database analysis must be done prior in a different program?

  • In my opinion you have to use the DB. You can connect the DB in QGIS and then use something like: Select count(*), GEO_REFERENCE from table group by GEO_REFERENCE – Mazu_R Jun 1 '18 at 9:55
1

The way to analyze databases in QGIS is by using Virtual Layers and creating a SQL Query for the database. You can create a new Virtual Layer under with the Layer > Add Layer > Add/Edit Virtual Layer.

This will create a virtual layer where you can name the layer and create the Query, in my case it looked something like this:

SELECT GEO_REF, COUNT(*) AS DEATHCOUNT
FROM DATABASENAME
GROUP BY GEO_REF
ORDER BY GEO_REF ASC

After that, it is easy to join the map layer to the new virtual layer to be able to map every time something repeats at every subdivision. And you can even add further filters this way.

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.