Wikipedia:Graphics Lab/Resources/QGIS/Get ready

This is an old revision of this page, as edited by MissMJ (talk | contribs) at 02:09, 11 June 2011 (Other GIS data: Copy-editing). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
The QGis interface. QGis can import GIS data—high quality topographic backgrounds, shaded reliefs, and administrative regions or borders—and apply styles to them.
Map with imported GIS data: topographic background, shaded relief, administrative borders, and OpenStreetMap roads. The labels, icons, and legend are easily added later using Inkscape.

QGis (full name: Quantum GIS) is a GPL license, cross-platform (Windows, Linux, Mac), and rather friendly cartographic software application. It is a Geographic Information System (GIS) program you can use to create, view, and analyze maps. In a nutshell, a GIS associates with each geographic coordinate (dot) on Earth a specific value from some survey. The best example of this is altitude: a topographic map, like the ones you see on the right, can be created from a GIS file in which each pixel represents not only a geographic coordinate, but also information about its altitude. Reversely, objects can be placed on a map and associated with specific coordinates; this is commonly used for features such as roads, bodies of water, state or province borders, urban areas, etc. As a result, these features are georeferenced on separate layers and their shape and ___location match their actual appearance on the surface of the Earth.

This approach radically changes the process of making maps. Formerly, the mapmaker or graphist had to personally draw each layer of a map, then combine them into an image. The work's reliability and precision were limited by the user's resources and knowledge. Now, the mapmaker can collect precise GIS data from reliable sources and simply load them into QGis. Objects will be automatically placed in their exact coordinates, allowing the user to apply custom styles and output an accurate basemap, which may be the end product, or a background to host additional custom layers (icons, labels, a legend, etc.). For Wikipedia, the advantages of GIS maps are precision, reliability, consistency, and an upgrade in visual elegance of the final images. Using QGis will be mainly helpful in generating topographic backgrounds (png, svg), shaded reliefs (png), and administrative regions or borders (png, svg), and applying various styles to them.

While GRASS GIS still seems to be the most common GIS software, it has a primarily command-line interface and can be difficult to learn and operate. Therefore, beginners will prefer QGis, which is quite powerful and user-friendly. It integrates GRASS GIS and GDAL data, provides an easier to use interface for GRASS GIS, and gives the user an opportunity to improve his or her GIS mapmaking skills.

This tutorial series will teach you how to use QGis to generate reliable maps for Wikipedia. Accordingly, it is Wikipedia-centered and focuses on outputting general public encyclopedic maps while following the Wikipedia map conventions.

If you would like a more comprehensive overview of QGis and its functions, you can read the official User Guide, available in several languages.

Step 1: Get the tools

Install QGis

Find your operating system from the list below and follow the link to the appropriate installer. Please don't install the sample data sets (North Carolina, etc.); you will be downloading more complete data later.

  • Windows (Standalone Installer) (fr, de) – You can also watch a video demonstrating the installation process [1], but be advised that it is out of date and describes currently inaccurate file sizes and download times.
  • Linux (fr, de)
  • MacOS X (FrameWorks) (fr, de)

While QGis will allow you to open many GIS files, we are mainly concerned with .tiff (raster, topographic) and .shp (vector) files. If you encounter any issues, you can browse and ask questions at the QGis Forum (very active, will generally answer in ~6 hours).

Create some helpful folders

On your desktop, or some other suitable place, create the following folders:

  • /QGis
    • /Data_ETOPO1
    • /Data_SRTM3v2
      • /Shaded
    • /Data_Naturalearth.com
    • (/Data_... [other source folders as needed])
    • /Tutorials
    • /Mapcolors
    • /Projects
    • /Examples
    • /Outputs
    • /[others as needed]

You need /Data_[sourcename] folders because data sets from each source may have different copyright status, coverage quality, or subjects (topography, political boundaries, etc.), and are usually made of dozens of files/tiles. Separate folders for each source will help you keep the files together and the sets organized. /Tutorial will host any interesting tutorials (webpages, PDF, etc.) you may find, which you can then edit or take notes on. Any color styles you will find online or create yourself can be saved into /Mapcolors. Your QGis projects will be saved in the /Projects folder, while you can use /Examples to collect any maps on Wikipedia that you like and want to study (reverse engineering). /Outputs will host the many intermediate outputs you will generate and look at to improve your mapmaking skills, as well as any finished maps you create.

Save your first color style

Copy-paste the following color code in an empty, plain text document (using something like Notepad or TextEdit), then save it in ./QGis/Mapcolors/ as Wikicarto_2.0.qml. We will frequently use it later.

: Colormap "Wikicarto_2.0.qml"
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis version="1.6.0-Copiapo" minimumScale="1" maximumScale="1e+08" hasScaleBasedVisibilityFlag="0">
  <transparencyLevelInt>255</transparencyLevelInt>
  <rasterproperties>
    <mDrawingStyle>SingleBandPseudoColor</mDrawingStyle>
    <mColorShadingAlgorithm>ColorRampShader</mColorShadingAlgorithm>
    <mInvertColor boolean="false"/>
    <mRedBandName>Not Set</mRedBandName>
    <mGreenBandName>Not Set</mGreenBandName>
    <mBlueBandName>Not Set</mBlueBandName>
    <mGrayBandName>Bande 1</mGrayBandName>
    <mStandardDeviations>0</mStandardDeviations>
    <mUserDefinedRGBMinimumMaximum boolean="false"/>
    <mRGBMinimumMaximumEstimated boolean="true"/>
    <mUserDefinedGrayMinimumMaximum boolean="false"/>
    <mGrayMinimumMaximumEstimated boolean="true"/>
    <mContrastEnhancementAlgorithm>StretchToMinimumMaximum</mContrastEnhancementAlgorithm>
    <contrastEnhancementMinMaxValues>
      <minMaxEntry>
        <min>-10458</min>
        <max>6741</max>
      </minMaxEntry>
    </contrastEnhancementMinMaxValues>
    <mNoDataValue mValidNoDataValue="false">-9999.000000</mNoDataValue>
    <customColorRamp>
      <colorRampType>DISCRETE</colorRampType>
      <colorRampEntry red="245" value="8000.000000" green="244" blue="242" label="altitude 19 neiges eternelles"/>
      <colorRampEntry red="224" value="7000.000000" green="222" blue="216" label="altitude 18 neiges eternelles"/>
      <colorRampEntry red="202" value="6000.000000" green="195" blue="184" label="altitude 17 neiges eternelles"/>
      <colorRampEntry red="186" value="5000.000000" green="174" blue="154" label="altitude 16 neiges eternelles"/>
      <colorRampEntry red="172" value="4000.000000" green="154" blue="124" label="altitude 15 neiges eternelles"/>
      <colorRampEntry red="170" value="3000.000000" green="135" blue="83" label="altitude 14"/>
      <colorRampEntry red="185" value="2000.000000" green="152" blue="90" label="altitude 13"/>
      <colorRampEntry red="195" value="1500.000000" green="167" blue="107" label="altitude 12"/>
      <colorRampEntry red="202" value="1000.000000" green="185" blue="130" label="altitude 11"/>
      <colorRampEntry red="211" value="800.000000" green="202" blue="157" label="altitude 10"/>
      <colorRampEntry red="222" value="600.000000" green="214" blue="163" label="altitude 9"/>
      <colorRampEntry red="232" value="400.000000" green="225" blue="182" label="altitude 8"/>
      <colorRampEntry red="239" value="300.000000" green="235" blue="192" label="altitude 7"/>
      <colorRampEntry red="225" value="200.000000" green="228" blue="181" label="altitude 6"/>
      <colorRampEntry red="209" value="150.000000" green="215" blue="171" label="altitude 5"/>
      <colorRampEntry red="189" value="100.000000" green="204" blue="150" label="altitude 4"/>
      <colorRampEntry red="168" value="50.000000" green="198" blue="143" label="altitude 3"/>
      <colorRampEntry red="148" value="20.000000" green="191" blue="139" label="altitude 2"/>
      <colorRampEntry red="172" value="1.000000" green="208" blue="165" label="altitude 1"/>
<!--      <colorRampEntry red="167" value="0.000000" green="223" blue="210" label="depression"/> -->
      <colorRampEntry red="216" value="0.000000" green="242" blue="254" label="altitude -1"/>
      <colorRampEntry red="198" value="-20.000000" green="236" blue="255" label="altitude -2"/>
      <colorRampEntry red="185" value="-50.000000" green="227" blue="255" label="altitude -3"/>
      <colorRampEntry red="172" value="-100.000000" green="219" blue="251" label="altitude -4"/>
      <colorRampEntry red="161" value="-250.000000" green="210" blue="247" label="altitude -5"/>
      <colorRampEntry red="150" value="-500.000000" green="201" blue="240" label="altitude -6"/>
      <colorRampEntry red="141" value="-750.000000" green="193" blue="234" label="altitude -7"/>
      <colorRampEntry red="132" value="-1000.000000" green="185" blue="227" label="altitude -8"/>
      <colorRampEntry red="121" value="-2000.000000" green="178" blue="222" label="altitude -9"/>
      <colorRampEntry red="113" value="-4000.000000" green="171" blue="216" label="altitude -10"/>
    </customColorRamp>
  </rasterproperties>
</qgis>

Step 2: Download the GIS data

  In progress

Types of data

Topography/bathymetry

 
Quality comparison between ETOPO1 (pixelated) and SRTM3 (smoother) data sets. This difference doesn't matter for making large maps with coverage greater than 1000km (~620mi) across.

ETOPO1 (topography/bathymetry)

  • one file for all the Earth (landmass and water)
  • low quality (1px = 1000x1000m); unzipped file is ~400MB–1.1GB, depending on the format
  • convenient for large maps depicting areas greater than 1000km (~620mi) across

(not working) GLOBE (topography)

  • 16 files/tiles to cover the all the Earth (landmass)
  • medium quality; unzipped landmass file is ~1.8GB

SRTM/SWBD (topography)

  • about 20,000 files/tiles to cover all the Earth (landmass)
  • high quality (1px = 90x90m); unzipped landmass file is 60GB+
  • slow to manage
  • for confirmed mapmakers

SRTM3 v4 (topography)

  • about 1,000 files/tiles to cover all the Earth (landmass)
  • high quality (1px = 90x90m); unzipped landmass file is 30GB+
  • slow to manage
  • for confirmed map makers

Other GIS data

Naturalearthdata.com (public ___domain) is a collection of GIS data within the following categories:

  • cultural—human and political, including borders for countries and smaller administrative divisions, as well as cities and urban areas
  • physical—coastlines, rivers, lakes, bathymetry, and geographic lines
  • raster backgrounds—Natural Earth 2 (topographic), ocean bottom, shaded relief grey

Which data should I get?

New users will prefer to simply download ETOPO1 for topography (precision: 1px = 1km x 1km). Don't use ETOPO2 which is actually an oldest version (1px = 2km x 2km).

Confirmed mapmakers will use the SRTM/SWBD for its better quality. The process is more complex :

  1. Know the coordinates of the area they want to map
  2. Find online these associated GIS files (also called tiles). Files have names such as "N22E112.hgt.zip", standing for 22⁰ North, 112⁰ East.
  3. Download them handly. Some for a small ilsland ; about one hundred for Korea ; + 5 thousands for Eurasia.
  4. Unzip them.
  5. Load them into QGis.

Step 3: Load a GIS file (layer) into QGis

QGis tutorial video,
watch the first minute.

Start QGis > in QGis' topbar, click icon "Add a Raster Layer" > Select the unzipped "ETOPO1_Ice_g_geotiff.tif", .shp, .shx, etc. > open. The data will appear in grey by default.
If you have a vector layer to load : click icon "Add a Vector Layer". Etc.

Step 4: Load some custom colors

Main page : Wikipedia:Graphic Lab/Resources/QGis mapcolor files - for more colormap files

To set custom colors, it is need to edit the layer's properties. Topographic GIS data are by default displayed using greys : a palette or mapcolor going from white to black. But you can use other palettes/mapcolors. Palettes/mapcolors are a set of colors that you appreciate and generally use.

Since the Graphic labs developed such guidelines for colors, the following mapcolors have been created, and shared, to ease the creation of wiki maps. Enjoy !

Existing color palettes

The QGis mapcolor files page already has some palettes you can use. Simply copy-paste the code into a text document, then save as PALETTENAME.qml. Then, in QGis : LAYER > Properties > Load a style > [browse and select the .qml file]

Step 5: Output your map, aka using the Print composer

 
What we want is this : an high quality topographic output (you can zoom in a lot !). With QGis and experience, we can get this in about 5 to 10 mins

You are now working with QGis, your GIS data (namely: ETOPO1), your customized palette. To output your first topographic background, don't use File > Save as Image, which is a simple screenshot. For a better quality :

  1. Use the Print composer: QGis (1.6) > File > New print composer (Ctrl+P). First, in this composer window, overfly its topbar icons : one pop up "Add new map". Click this icon, then click&drag on the white area to put the map, then adjust. Second, on the right box : General > Composition > Paper quality > Size > Custom : set the size you want, larger it is, higher will be your output quality !
  2. Smoothing colors: be sure the color style is set to "linear":
QGis (1.6) > Layer > Properties > Colormap > Color interpolation : set on "linear". The output will now be smoother, colors going smoothly from one to another.

Then : Composer > File > Export as image/PDF/SVG, and that's it, an high quality topo background.

Other functionalities

Grids: Within the Print Composer > selecting an item > Item (right side) > Grid > customize as you wish/can. Add icons: user/share/qgis/svg/

Links

 

The table above has links to various tutorials and resources which can help in the creation of Wikipedia maps from digital georeferenced data (GIS).