3

I'm trying to merge several shapefile layers.

Each of the layers has three attributes:

  • CGRSName: Name of the grid cell (same for each shapefile)
  • CGRSType: explains the type of grid (not important for this case)
  • Taxon: with the name of the species for each of the shapefile.

In example one shapefile attribute table would look like this:

attribute table example

I would like to merge all the layers in one, while also merging all the different taxa that repeats in a the same grid, i.e. 35TMH3 in one cell (like Taxon and one cell saying Aesculus hippocastanum,Rosmarinus officinalis).

I've tried using join attributes by localization and merging vectorial layers, but it always gives me two row with the same CGRSName but different Taxon.

  • 2
    Have you tried join by attribute based on the CGRS? – Erik May 14 at 14:11
  • Is there a particular reason you would want the output to have all Taxon in a single concatenated string as opposed to separate fields? – JoshC May 14 at 15:09
  • I want one of the layers with concatenated string to have an easy manageable layer, because otherwise the layer it's super heavy (i also keep the heavy one with taxon non concatenated for some of the analysis) – Rober May 15 at 10:54
1

First use merge tool to merge all shapefiles into one layer. Then create virtual layer like you see in this answer

Only your query should be something like this:

SELECT "CGRSName", "CGRSType", group_concat(Taxon) FROM "merged" GROUP BY CGRSName

Where "merged" is name of your new layer.

But for most further analysis and representations would be handier to keep data in form of merged layer without concating several Taxons into single field.

0

Have you tried raster to points. Then join summary statistics with the points. Once that is complete you can do a raster calculation to get the totals for every cell.

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.