User:Rbrausse/distribution maps with QGIS

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
For a (similar but outdated) German version take a look at de:Wikipedia:Redaktion Biologie/Verbreitungskarten/How-to QGIS.

In 2010 the IUCN released a part of the distribution data. The published ESRI shape files can be used for creating distribution maps with geographic information systems like QGIS.

Installation

[edit]

Data Sources

[edit]

Base Map Preparation

[edit]

Relief

[edit]
QGIS desktop after layer adding

QGIS is a layer-based tool. The base map consists of a relief and country/state bounderies.

Used layer stack from bottom to top:

  • Add Raster Layer: SR_HR.tif (relief, package Shaded Relief)
  • Add Vector Layer: ne_10m_admin_0_boundary_lines_land.shp (country bounderies, package Cultural Vectors)
  • Add Vector Layer: ne_10m_admin_1_states_provinces_lines.shp (state bounderies, package Cultural Vectors)
  • Add Vector Layer: ne_10m_bathymetry_L_0.shp (mean sea level,package Physical Vectors)
  • Add Vector Layer: ne_10m_coastline.shp (coasts, package Physical Vectors)

The added layers are loaded with a default style, the following settings are useful for creating maps:

customized style
  • general advice: Group the layers
  • ne_10m_admin_0_boundary_lines_land: Black or dark gray, transparency 40%, width 0,15
  • ne_10m_admin_1_states_provinces_lines: Black or dark gray, transparency 40%, width 0,09
    • Query: "COUNTRYNAM" = "Russia" OR "COUNTRYNAM" = "Canada" OR "COUNTRYNAM" = "United States of America" OR "COUNTRYNAM" = "China" OR "COUNTRYNAM" = "Brazil" OR "COUNTRYNAM" = "Australia" OR "COUNTRYNAM" = "India"
  • ne_10m_bathymetry_L_0: White (color and border color), transparency 0%
  • ne_10m_coastline: A light gray, transparency 30%, width 0,1

For colored maps use Natural Earth II with Shaded Relief, Water, and Drainages instead of the shaded relief and skip both ne_10m_bathymetry_L_0 and ne_10m_coastline.

Inset Map

[edit]
Layers used for the inset map

Used layer stack from bottom to top:

  • Add Vector Layer: ne_10m_coastline.shp (coasts, package Physical Vectors)
  • Add Vector Layer: ne_10m_land.shp (landmass, package Physical Vectors)
  • Add Vector Layer: ne_10m_admin_0_boundary_lines_land.shp (country bounderies, package Cultural Vectors)

The following styles are used:

  • ne_10m_coastline: Some gray
  • ne_10m_land: Same gray
  • ne_10m_admin_0_boundary_lines_land: Dark gray, width 0,1
[edit]
basic Print Composer layout

The print composer is used for combining the two layer stacks (relief and inset).

Used settings:

  • General remark: Drawing the content of the map is processor intensive, QGIS seems to be more reliable if the composition is only drawn with exporting. Display the map only for placing the inset map or circles for accentuation.
  • Composition: Width 160, Height 120, Quality 150 dpi
  • Relief map: Disable unused layers, add a new map in the composer (see also this QGIS tutorial)
    • Item Properties -> Map -> activate "Lock layers for map item"
    • Item Properties -> General Options -> "Position and Size.." Coordinates 0/0, width and height like the composition
    • Item Properties -> General Options -> deactivate "show frame"
  • Inset map: Disable unused layers, add a new map in the composer
    • Item Properties -> Map -> activate "Lock layers for map item"

Adding IUCN data

[edit]
Relief map and AMPHANURA layer, with active Physalaemus fernandezae query

The species Physalaemus fernandezae is part of the AMPHANURA.shp, this vector layer is added twice (sic!).

Move one above the "inset map" group and the second above "relief map".

The following style settings are a solid starting point for map production:

  • Distribution range on the relief: Dark red, transparency 70%, add a second symbol layer (Type simple line, same red as the filling)
  • Distribution range on the inset: Dark red, transparency 40%

Both AMPHANURA layer need a query:

  • "BINOMIAL" = "Physalaemus fernandezae" AND "PRESENCE" = 1
  • See spatial metadata for a field description

Producing maps

[edit]
Print Composer: Only the relief is updated
Finished map before exporting
Done!
  • Activate all relief map layers (i.e. group "relief" and the IUCN layer above the group)
  • Select "Zoom to layer extent" in the context menu of the IUCN Layer (AMPHANURA)
  • Select a fitting scale (below 1:2,5*10^6 the Natural Earth relief will look ugly)
  • Perform the following steps in the print composer:
    • Select relief map
    • Item Properties -> Map -> deactivate "Lock layers for map item"
    • Item Properties -> Map -> select "Update preview"
    • Item Properties -> Map -> activate "Lock layers for map item"
    • Item Properties -> Extents -> select "Set to map canvas extent"
  • Activate all inset map layers (i.e. group "inset" and the IUCN layer above the group)
  • Set scale to e.g. 1:2,5*10^7
  • Perform the following steps in the print composer:
    • Select inset map
    • Item Properties -> Map -> deactivate "Lock layers for map item"
    • Item Properties -> Map -> select "Update preview"
    • Item Properties -> Map -> activate "Lock layers for map item"
    • Item Properties -> Extents -> select "Set to map canvas extent"
    • Move inset map to a suitable position
    • Select "Export as image"

When creating multiple maps with one IUCN shape the steps described above are only performed once. Every following map is done this way:

  • Update query of the IUCN distribution layer
  • Zoom to layer extent
  • Set a scale for the relief
  • Select relief map in the composer, Item Properties -> Extents -> select "Set to map canvas extent"
  • Set a scale for the inset map
  • Select inset map in the composer, Item Properties -> Extents -> select "Set to map canvas extent"
  • Export as image

License

[edit]

IUCN's data is CC-BY-SA, see Commons:IUCN Red List and {{IUCN map permission}}, Natural Earth is public domain.

Using bounderies as inset map location marker

[edit]
  • Download and install the plugin Rectangles, Ovals, Diamonds
  • Download and install the plugin Numerical Vertex Edit
  • Activate the plugins "Add Delimited Text Layer" (built-in), "Rectangles, Ovals, Diamonds" and "Numerical Vertex Edit"
  • Add an IUCN distribution layer and select a fitting extent and scale
  • Create the relief map in the print composer, use the values of Item Properties -> Extent to determine the center (this example is based on Barkudia melanosticta):
    • X coordinate: (78.877 + 88.443) / 2 = 83.66
    • Y coordinate: (14.113 + 21.287) / 2 = 17.7
    • Width: 88.443 - 78.877 = 9.566
    • Height: 21.287 - 14.113 = 7.174
    • Create a text file with the following content:
CENTER_X,CENTER_Y,WIDTH,HEIGHT
83.66,17.7,9.566,7.174
  • Use the Text Layer plugin to load the file
  • Save the layer as Esri Shapefile, load the new file and remove the layer added by the Text Layer plugin
  • Use the Rectangle plugin to create a new layer and set a fitting style (e.g. Filling: No brush, Border: Solid Line)
  • Select a fitting scale for the inset map and activate the appropriate layers, including the new rectangle layer
  • Update the inset map in the print composer

Moving the rectangle

[edit]
  • Add a column to the attribute table of the center, to distinguish rows (e.g. a string field, called "SPECIES")
  • Use the print composer to determine center, width and height of the relief map
  • Toggle the edit mode for the center point layer
    • Add a new point somewhere in the middle of the area, with the values WIDTH, HEIGHT (as calculated) and SPECIES (I use the binomial of the current map, but the value has to be unique)
    • With the Numerival Vertex Edit move the point to the center coordinates (changing the coordinate values in the attribute table is not a valid way to move the center point)
  • Create a new boundery with the rectangle plugin, and overwrite the shapefile. Don't let the plugin load the file as a new layer.
  • The boundery layer is filteres with a query, in this example "SPECIES" = "Barkudia melanosticta"
  • Save the project
  • Reload the project
    • Takes time
    • Crashes sometimes
    • But: The boundery box is drawn and the same layer is used. This makes handling of the whole issue much easier as the print composer layers can stay fixed

Splitting and cropping vector layers

[edit]
Select the feature in the attribute table
Loaded vector layer with a selected feature
Mannar and the Western Ghats are defined as one feature
Splitted feature
Last remaining data point

Sometimes the distribution range provided by IUCN is outdated, newer resources like The Reptile Database define smaller areas.

The range data provided by IUCN for the species Sphenomorphus dussumieri includes Sri Lanka, this is corrected in RDB (Not in Sri Lanka, fide SOMAWEERA & SOMAWEERA 2009).

The spatial data of the S. dussumieri range is defined within one data row, this feature has to be cropped for a map according to RDB. As filtered shape files are read-only the vector layer has to be exported.

  • Open the attribute table
  • Select the row
  • Export the selected data with Save Selection As...
  • Load the exported file as vector layer

The newly created layer is editable and can be manipulated.

  • Toggle Editing
  • Use Select Single Feature to highlight one part
  • Delete Selected removes the marked part
  • ..repeat..

The tricky part is the one feature combining Mannar and the Western Ghats, selecting a single feature isn't sufficient anymore. This is solvable with splitting the layer.

  • Use Split Feature to divide the area
  • Select Single Feature -> Delete Selected
  • Repeat

The last incorrect data point can be deleted without interfering the correct distribution range.

Localisation of city names

[edit]
Both city layers are loaded, label fields: "NAMEALT" (above) and "NAME" (below)
Attribute editor
All visible "NAMEALT" fields are localised
Only the layer with "NAMEALT" labels is used in the print composer

The vector layer "populated places" (part of Natural Earth) includes cities, though the names are in English. For localised labels a translation is needed, one way is to abuse the column "NAMEALT". In some cases NAMEALT is filled already, but the content is often wrong and/or misleading.

As populated places contains over 7000 entries the localisation of the whole file is tedious, a more specific approach can be the following:

  • Load the layer "ne_10m_populated_places"
  • Set as query ""FEATURECLA" LIKE "%capital" OR "SCALERANK" IN ( 1, 2, 3 )" (IMHO a globally useful subset with about 2500 entries)
  • Export the filtered layer as shape file
  • Load the exported file twice
  • Activate labels, one layer "NAME" (displayed e.g. below), the other "NAMEALT" (displayed e.g. above)
  • Toggle edit mode for the "NAMEALT" layer
  • Use the "Identify Features" tool to select a city, select (Actions) -> Edit feature form
  • Change the name in the field "NAMEALT"
  • Repeat...

For exporting use only the "NAMEALT" labels in the print composer.

Miscellaneous

[edit]
  • accentuation (example)
    • Place a circle around small ranges on the relief map
    • Add a symbol layer of the type "centroid fill" in the IUCN layer of the inset map
  • Grouping and legend (example)
    • Use the style "Categorized" instead of "Single symbol"
    • Add a legend within the print composer
  • Natural Earth has many more vector layers, e.g. lakes and rivers

Extraterrestrial geodata

[edit]
Raster map of the moon with two vector layers. Highlighted are the south side of the moon and the astronaut-named feature Weird

QGIS (and other GIS applications) are not limited to the Earth, the moon map was made with the Moon Nomenclature (the KML version, the shape file is not -180° to +180° but 0° to 360°) and both raster and vector sources from ftp://pdsimage2.wr.usgs.gov/pub/pigpen/moon/. An overview of all USGS-provided extraterrestrial map data can be found on the homepage.

Inconsistent distribution data

[edit]
Inconsistent distribution: Both RDB and IUCN place the species incorrect

Quite often the range data is inconsistent, in this showcase example both IUCN and RDB provide contradictorily data (points):

  • Both RDB and IUCN describe the type locality as Fort Munro, Punjab, Pakistan (29° 55′ 33″ N, 69° 59′ 0″ E)
  • IUCN's map data is shifted to the west
  • RDB's type locality coordinates are off by about 4 degree (25° 53’ N, 70° 3’ E)

Misleading exactness

[edit]

Both maps of Mycena purpureofusca are wrong and shouldn't be used. The first one mixes artificial bounderies (countries and states) with a physical base map (the underlaying raster portrays the world environment in an idealized manner with little human influence) - the result is misleading, the mushroom does not grow e.g. all over Turkey, a country spanning two continents and multiple biomes. The second map showing Poland is based on actual sightings of M. purpureofusca, but doesn't include other sources: As the fungus is found in both Germany and Czech the range has to be extended to the west and south.

M. purpureofusca in a less misleading style

When range informations are only available on country/state level a plain base map should be used to avoid deceptive exactness.