Wikipedia:Graphics Lab/Resources/QGIS/Get ready

This is an old revision of this page, as edited by MissMJ (talk | contribs) at 22:48, 10 June 2011. 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 below, can be created from a GIS file in which each pixel also carries 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, lakes, 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 than 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.

The tools

QGis

QGis is the rather friendly GIS mapmaking software we are willing to use.

sudo apt-get install add-apt-repository 
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install qgis
  • Files: Allow to open many GIS files, for us mainly .tiff raster topographic GIS files, and .shp (shapefiles) vector GIS files.
  • Forum : http://forum.qgis.org (very active, answer in ~ 6 hours)
Empty folders to create
  • /Desktop/ (or other suitable place)
    • /QGis/
      • /Data ETOPO1
      • /Data_SRTM3 v.2
        • /Shaded
      • /Data_Naturalearth.com
      • /Data_...
      • /My_tutorials
      • /My_mapcolors
      • /My_projects
      • /My_examples
      • /My_outputs
      • /[other as you need it !]

The /Data_[sourcename] folders are need since each data source may have different copyrights status, coverage quality, subjects (topography ? politic ?), and is usually made of dozens of files/tiles, so create separate data folders make sense. /My_tutorials, /My_mapcolors, /My_projects, /My_examples, /My_outputs will likely be useful too. /My_tutorial will host interesting tutorials (webpages, pdf, etc) you will find, you may also edit them, and take your own notes. /My_mapcolors will host the color styles you will find online or create and save there. /My_projects will host your QGis projects. /My_examples will be a collection of maps you saw on wikipedia, love, and want to study (copy engineering). /My_outputs will host the some dozen of intermediate outputs you will generate and frequently look at to improve yourself through your learning process.

First color style

Copy-paste the following color code in an empty text document, then save in ./QGis/My_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>

GIS data

  In progress

Topography/bathymetry
 
Quality comparison ETOPO1 vs SRTM3 (better). This difference doesn't matter when you make large maps >1000km
Other GIS data
  • NaturalEarthData,com (Public Domain) : collection of GIS data, with:
A. Cultural (human or political including: Countries polygons ; Sub-countries polygons ; Borders lines ; urban areas ) ;
B. Physical (Coastlines, rivers, lakes, bathymetry ; geographic lines) ;
C. Raster background (natural earth II, topographic ; ocean bottom ; shaded relief grey)
http://www.naturalearthdata.com/features/
Which data for YOU

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.

Load the GIS file (layer) into QGis

QGis tutorial video,
watch the first minute.
Load data (topography)

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 great by default.
If you have a vector layer to load : click icon "Add a Vector Layer". Etc.

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 paletters/mapcolors. Palettes/mapcolors are a set of colors that you appreciate and generally use.

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

Installation

To copy-paste in text document, then save as PALETTENAME.qml. Then, in QGis : LAYER > Properties > Load a style > [browse and select the .qml file]

Output : 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.

Others functionalities

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

 

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