[Qgis-user] Automating creation of county distribution maps

Bernd Vogelgesang bernd.vogelgesang at gmx.de
Sat Mar 12 01:43:53 PST 2022


Hi Mike and list,

I took the challenge and so far succeeded at the very moment. Mike sent
me a (not so clean list) of species and counties.

My idea was to produce an atlas. (Actually, it should be made by a
report, but since those are a bit quirky still, I went the pure atlas way)

It's a bit hacky, a more straightforward way would be nice.

- cleaning the data and importing them (table species/county, county
polygons)

- create table of individual species (toolbox "Delete duplicates by
attribute") -> 101 unique species

- Setting up a relation between county layer and species/county-table on
the county name

- new text field in county layer "species" :

relation_aggregate('name_of_relation', 'concatenate', "species_names", ',')

this creates a comma-separated list of species for each county polygon

Prepare Atlas

Coverage layer: (fake coverage, as it does not move)

- create bounding box of the county-layer (Extract layer extent)

- take list of individual species and add the geometry: retrieved the
wkt of the extent in the field calculator -> "Geometry by expression":
geom_from_wkt('Polygon ((355937 4117435, 782844 4117435, 782844 4498773,
355937 4498773, 355937 4117435)')

-> 101 extents with species name as atlas coverage

- create new map layout

- Activating atlas, setting species name-field as page name

- duplication of the county-layer and setting up a rule based style:

visible: array_contains( string_to_array( "species_names",','),
@atlas_pagename)

invisible: else

this query will look for the pagename (= species name) in the array of
species names in the county polygons, and if the name is in, then the
polygon is shown in grey, alse transparent.

add text field @atlas_pagename

set atlas output filename to @atlas_pagename

Export atlas as images

DONE

Question: is there a way to aggregate the species per county without
setting up that relation beforehand? This is an extra step which would
be nice if it could be circumvented by some cool function.

Any ideas or comments?

Am 12.03.22 um 10:04 schrieb Jésahel Benoist via Qgis-user:
> Hello Mike,
>
> I tried to follow your question and the most I read the less I
> understand !
> Could you simply explain what you want to see, what action the user
> have to do and what he gets?
> For this, try to give input data and what will link them : plants
> (table with plant name and states distribution?), states (geometric
> data with states names?), columns to link...
> The good point is that I'm sure QGIS can do this. But nobody will
> engage work if objective isn't precise enough.
>
> Regards,
>
> J. B.
>
>
> Le ven. 11 mars 2022 à 21:50, Mike Breiding - Morgantown WV via
> Qgis-user <qgis-user at lists.osgeo.org> a écrit :
>
>     I had the range USA range map in the screen shot and have since
>     updated
>     it. https://photos.app.goo.gl/ktn5quT6s6SRwrzBA
>     WV-Mike
>     ------------
>     On 3/10/2022 11:04 AM, chris hermansen wrote:
>     > Perhaps others are better understanding how you want to
>     visualize the
>     > distributions, but what I get from your description is that if
>     you have
>     > 100 (or 2500) species then you will have 100 (or 2500) maps, which
>     > sounds unwieldy to me.
>
>     I neglected to mention the use for the distribution maps.
>     They will be used in a print brochure.
>     A page mock up can be seen here:
>     https://photos.app.goo.gl/ktn5quT6s6SRwrzBA
>
>     The USA distribution map in the mock up was made in Qgis using the
>     information from:
>     https://plants.usda.gov/home/plantProfile?symbol=BODI2
>
>     This is interactive and will display down to the state and county
>     level.
>     However, they are not up to date at the state/county level. If
>     they were
>     I would simply make a screen shot and that would be the end of it.
>
>     The state distribution map used in the mock up was made using Qgis
>     based
>     on data from the West Virginia University Herbarium which has the
>     most
>     up to date information on distribution.
>
>     WV-Mike
>
>
>
>     _______________________________________________
>     Qgis-user mailing list
>     Qgis-user at lists.osgeo.org
>     List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>     Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info:https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20220312/eebcac93/attachment.html>


More information about the Qgis-user mailing list