3

I am using QGIS 2.0.1 under Mac OS-X 10.8.2. I have a layer of counties in New Mexico to which I have joined a csv file that includes presence / absence of plant species by county. I've set up the layer style to show presence (coded "1") as grey and absence (coded "0") as white. So I can go into "Layer Properties", go to "Style", select the appropriate plant from the "Column" pull-down list, and I have a map that is nicely filled to show counties in which the plant is present.

The question is--how do I create an output image for each species showing its distribution?

At present, what I would have to do is the following: 1) Select a species from the pull-down list in "Layer Properties": 1a yielding a map that looks like this: 1b 2) Enter "Print Composer", get all that set up, export as an image: 2 3) Switch back to the main QGIS window, open up "Layer Properties", and select the next species: 3a 3b 4) Switch back to the Print Composer, and export the next image: 4

Now, that all works, but given that I have several thousand species to deal with, this is not a remotely efficient way of approaching the issue. So I am trying to figure out how to automate map creation so that I can create a set of images incremented over all the attributes in this layer. So far, I've come up empty. The "Atlas Generation" plugin that's been integrated into the Print Composer seems to solve essentially the same issue, but so far as I can tell it can only increment across rows (features) and has no ability to increment across columns (attributes). Any suggestions?

3

In this case, I would recommend creating a layer with one (multi)polygon per species which you can then use as input for the Atlas plugin.

I assume your csv looks similar to:

county,species1,species2,species3
1,0,0,1
2,0,1,1
3,1,0,0

You can transform this to the following form:

county,species
1,3
2,2
2,3
3,1

Then you can join this data with the county polygon data. Finally, you can dissolve the polygons based on the species number to create one (multi)polygon per species.

  • 2
    Excellent, thanks! It took me some additional poking around to get everything working properly. It required a one-to-many join, see discussion here: link and here: link. – aspidoscelis Feb 8 '14 at 22:59
  • And for layer style, I used $id = $feature as discussed here: link. – aspidoscelis Feb 8 '14 at 23:02
  • 1
    I couldn't get the Atlas Generator to do what I wanted in the current KyngChaos build, but the current nightly build from Dakota Cartography worked: link. – aspidoscelis Feb 8 '14 at 23:03
  • 1
    Correction: $id = $atlasfeatureid. I don't know what $feature does in this build of QGIS, but not anything helpful for my purposes. – aspidoscelis Feb 9 '14 at 0:39

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.