Wikipedia:Graphics Lab/Resources/QGIS/Get ready: Difference between revisions

Content deleted Content added
 
(38 intermediate revisions by 11 users not shown)
Line 1:
[[File:QGis_Print_composer_output_-_06_localizator_starting_point_(correct).png|thumb|300px|The QGis interface. QGis can import GIS data—high quality topographic backgrounds, shaded reliefs, and administrative regions or borders—and apply styles to them.]]
[[File:Washington_topographic_map-fr.svg|300px|thumb|Map with imported GIS data: ➊. NASA's topographic background, shaded➋. relief,NaturalEarth's administrative borders, ➌. [[OpenStreetMap|OSM]]'s roads and urban areas, ➍. TheNASA based shaded relief (+GIMP).<br />➎. labelsLegends, icons, andscale, north arrow, localizator, topographic legend are easily addeddrag&drop lateradded using [[Inkscape]].<!--➊➋➌➍➎➏-->]]
[[File:Chinese plain 5c. BC-en.svg|thumb|300px|right|Made using GIS data 'ETOPO1', QGis, this QGis tutorial, Inkscape, and the Wikipedia map conventions. Late Spring and Autumn Period, 5th centry BCE, before the breakup of Jin and the Qin move into Sichuan.]]
 
Line 17:
If you would like a more comprehensive overview of QGis and its functions, you can read the [http://qgis.org/en/documentation/manuals.html official User Guide], available in several languages.
 
=Step 0.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.
 
* [http://www.qgis.org/wiki/Download#Windows Windows] (Standalone Installer) ([http://www.qgis.org/wiki/DownloadFr fr], [http://www.qgis.org/wiki/DownloadDe de]) – You can also watch a video demonstrating the installation process [http://vimeo.com/9476971], but be advised that it is out of date and describes currently inaccurate file sizes and download times.
* [http://www.qgis.org/wiki/Download#Linux Linux] ([http://www.qgis.org/wiki/DownloadFr#Linux fr], [http://www.qgis.org/wiki/DownloadDe#Linux de]), for Ubuntu:
::sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable #For versions >1.7.0
::sudo apt-get update
::sudo apt-get install qgis
* [http://www.qgis.org/wiki/Download#MacOS_X MacOS X] (FrameWorks) ([http://www.qgis.org/wiki/DownloadFr#MacOS_X fr], [http://www.qgis.org/wiki/DownloadDe#MacOS_X de])
 
While QGis will allow you to open many GIS files, we are mainly concerned with '''.[[Tagged Image File Format|tiff]]''' (raster) and '''.[[Shapefile|shp]]''' (vector) files.
{{important|If you encounter any issues, you can browse and ask questions at the [http://forum.qgis.org QGis Forum] ({{green|veryno more active}}), willor generallyanother answer in ~6 hours}})forum.}}
 
==Create some helpful folders==
Line 36 ⟶ 39:
&rarr; QGis
:&rarr; Data_ETOPO1
:&rarr; Data_SRTM3v2Data_SRTM
::&rarr; Shaded
:&rarr; Data_Naturalearth.com
Line 56 ⟶ 59:
*Your QGis projects will be saved in the ''Projects'' folder.
 
*''Examples'' let'slets you 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.
|}
 
=Step 0.2: Download the GIS data=
==Save your first color style==
{{See also|Wikipedia:Graphic_Lab/Resources/Gis_sources_and_palettes{{!}}/GIS sources & palettes (English)||:fr:Aide:Cartographie/Ressources cartographiques géoréférencées#Sources des données{{!}}French|:de:Hilfe:GMT#Topographische_Datens.C3.A4tze{{!}}German}}
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.
:{{done}}— section updated (2012/02)
{{summarization|title=: Colormap "Wikicarto_2.0.qml"|1=<pre>
There are 2 kinds of data: raster GIS files — surfaces with limited precision represented by dots (pixels) — most of time topographic data; and vector GIS files — dots, lines and polygons. Below are both the biggest families, and some links to download the files needed for this tutorial.
<!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>
</pre>
}}
 
=Step 2: Download the GIS data=
==Types of data==
===Topography/bathymetry===
{{See also|Wikipedia:Graphic_Lab/Resources/Gis_sources_and_palettes{{!}}/GIS sources & palettes (English)||:fr:Aide:Cartographie/Ressources cartographiques géoréférencées#Sources des données{{!}}French|:de:Hilfe:GMT#Topographische_Datens.C3.A4tze{{!}}German}}
 
[[file:QGis_ETOPO1_vs_SRTM3_-_quality_match.jpeg|thumb|600px|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.]]
* {{Cite GIS data for Graphic Lab |name=ETOPO1 |url_download=http://www.ngdc.noaa.gov/mgg/global/global.html |publisher=[[NGDC]]-[[NOAA]] |year=2009 |license= Public ___domain |tag= standard |url_doc=http://www.ngdc.noaa.gov/mgg/global/etopo1sources.html |layers=topography & bathymetry |precision_max=1850m (1minute arch) |covered_area= all Earth (90N-90S, landmass & sea floor) |datum=WSG WGS&nbsp;84 |projection = (?) |extensions=.zip → .tif and others |size_compressed=326Mo |size_uncompressed=900Mo |tile_size=whole earth |tiles_total= 1 |comment = Perfect for very large maps (ex: > France).|editor_note= For this tutorial, Downloaddownload: [http://www.ngdc.noaa.gov/mgg/global/relief/ETOPO1/data/ice_surface/grid_registered/georeferenced_tiff/ ETOPO1 Ice Surface (grid registered)], or [http://www.ngdc.noaa.gov/mgg/global/relief/ETOPO1/data/bedrock/grid_registered/georeferenced_tiff/ ETOPO1 Bedrock (grid-registered)]. nb: ETOPO1 (1px=1km²) is a better data than ETOPO2 (lower quality1px=2kmx2km). |editor_note= }}
* {{Cite GIS data for Graphic Lab |name= SRTM3 (90m) |url_download= http://demex.cr.usgs.gov/DEMEX/ |publisher= NASA / USGS |year= 2000 |license= Public Domain |tag= standard |url_doc= http://dds.cr.usgs.gov/srtm/version2_1/Documentation/SRTM_Topo.pdf |layers= topography |precision_max= 93m (3"arch) |covered_area= 60⁰N-56⁰S (landmass only) |datum= WGS &nbsp;84 |extensions= .tif |size_compressed= |size_uncompressed= |tile_size= on command |tiles_total= 1 |comment = Perfect for small areas anywhere in the world. Need to create a free account. Worth it. You will use this source frequently. |editor_note= For this tutorial, and since GIS data are quite heavy (SRTM3 90m, Aster 30m), select and download the smallest area possible (Taiwan, Hongkong are good choices with both sea and mountains).}}
{{Collapse|title=Depreciated 'tiles download' approach|1=
 
Formerly, high precision topographic GIS datas being too big —about 60GB for the whole Earth—, these datas were split into dozens, hundreds, or thousands small tiles about some MB each. The mapmaker had to find, download, unzip, load the several needed tiles (say 10 tiles for Danemark), and manage these 10 tiles in parallel for color styles, effects, etc. However, the process is a more complex than downloading a single file. You will need to:
===Other GIS data===
[http://www.naturalearthdata.com/features/ 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 topographic GIS data should I get?===
;For this lesson
'''New users''' should download topographical data from ETOPO1 (1px = 1km x 1km). Please download a ''grid-registered, georeferenced tiff'' in either Ice Surface or Bedrock and unzip it into your ''Data_ETOPO1'' folder.
 
;For more precise works
{{summarization|title=: Depreciated 'tiles download' approach|1=
Formerly, the topographic GIS files being too big —about 60GB for the whole Earth—, this data was split into dozens, hundreds, or thousands small tiles about some MB each. The mapmaker had to download the several needed tiles (say 10 tiles for Danemark), and manage these 10 tiles in parallel for color styles, effects, etc. For maps needing a topographical base, '''confirmed mapmakers''' will prefer to use the SRTM3 for its better quality. However, process is a bit more complex than downloading a single file. You will need to:
# '''Know''' the coordinates of the area you want to map—although you do have the option of visually selecting the area on the download page.
# '''Find''' the associated GIS files (also called '''tiles'''). SRTM files have names such as "N22E112.hgt.zip", standing for 22⁰ North, 112⁰ East.
Line 155 ⟶ 81:
}}
 
===Other GIS data===
Far better now, the recent (2011 Sept.) NASA / USGS "Demex" system allows the mapmaker to select a far wider area using the cursor, or to specify some geographic coordinates as limits to download an unique (and as heavy as its surface is big !) tile for this area. You need to create an account, but that's clearly worth it.
;Provinces:
* {{GIS data for Graphic Lab |name= Admin level 1 : State/Provinces polygons (10m-admin-1-states-provinces) |url_download=http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/10m-admin-1-states-provinces-shp.zip |publisher=[http://www.naturalearthdata.com/ Naturalearthdata.com] |year= 2009 |license=Public ___domain |tag= standard
|url_doc=http://www.naturalearthdata.com/downloads/10m-cultural-vectors/10m-admin-1-states-provinces/ |layers=major rivers lines |precision_max= |covered_area=whole earth |datum=WSG84 |projection =Geographic projection(?<!-- what that ? source : http://www.naturalearthdata.com/features/ -->) |extensions=.zip →.shp |size_compressed=14Mb |size_uncompressed=19Mb |tile_size=whole Earth |tiles_total=1 |comment = <u>For ___location maps</u>, large and local, and complex maps (political, military, history).|editor_note= }}
;Others existing
There are vatious other GIS layers available online. By example, [http://www.naturalearthdata.com/features/ Naturalearthdata.com] (public ___domain) is a collection of easily usable GIS data with the following categories:
*cultural—human and administrative (areas or borders) for countries (L-0) and smaller administrative divisions (L-1, L-2, L-3), 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
To see our selection, go to the /Gis_sources_and_palettes subpage.
 
=Step 0.3: Load a GIS file as a layer=
For maps needing features such as national borders, cities, rivers, etc., data sets from Natural Earth provide a range of options in various levels of detail. They are simple to select and work with, so both beginner and confirmed mapmakers will find them useful to download.
 
=Step 3: Load a GIS file into QGis as a layer=
[[Image:QGis tutorial - layers toolbar.png|thumb|right|super|450px|1. Add Vector Layer, 2. Add Raster Layer, 3. Remove Layer(s)]]
Loading a GIS file adds the data into your project as a [[Layers (digital image editing)| layer]]. For our purposes, we care about '''vector layers and raster layers'''. There are three ways you can add layers into your project: using the menu, using the keyboard shortcuts, or using the toolbar icons.
Line 171 ⟶ 104:
Since the ETOPO1 data is a raster file, go ahead and add it to your project using whichever ''Add Raster Layer'' method you prefer.
 
<div class="center">
<gallery widths="500px" heights="300px">
file:QGis_Data_load_-_01_raster_topography.png |1. Adding a raster layer.
file:QGis_Data_load_-_02_raster_topography.png |2. Topographical data will appear in grey.
</gallery>
</centerdiv>
 
=Step 4: Add some custom colors=
:''Main page : [[Wikipedia:Graphic Lab/Resources/QGis mapcolor files]] - for more colormap files''
The topographic GIS data you downloaded is by default displayed using a monochromatic palette (mapcolors) going from white to black; however, you have the option of using other colors. You can either load an existing mapcolor file, edit an existing mapcolor file or create your own mapcolors. To do this, you will need to edit the layer's properties.
 
Please note that per the Wikipedia [[Wikipedia:WikiProject Maps/Conventions| map conventions]], you should use the colors provided for all topographical shading.
 
==Loading mapcolors==
For this, you will be using the '''Wikicarto_2.0.qml''' file you created earlier in this tutorial.
 
# Right click on the layer name in the ''Layers'' window and select ''Properties''. The ''Layer Properties'' window will pop up.
# Under the ''Symbology'' tab, click ''Load Style ...'' at the bottom of the window.
# Find and select '''Wikicarto_2.0.qml''', then hit ''Open''.
# Click ''OK''. Your map should now be in color!
 
<gallery widths="500px" heights="300px">
File:QGis_Load_mapcolor_style_-_01_properties_window.png | The default layer properties window.
File:QGis Print composer output - 06 localizator starting point (correct).png | The final result.
</gallery>
 
==Editing mapcolors==
[[File:QGis_Load_mapcolor_style_-_02_mapcolor_box.png|thumb|400px|The ''Colormap'' tab with colors already loaded.]]
If you would like to edit already loaded mapcolors, simply go to the ''Colormap'' tab. There, you can add or delete entries by selecting them and clicking the appropriate buttons. You can also edit the ''Value'', ''Color'', and ''Label'' fields of any entry by simply double clicking on the field you wish to change. Click ''Apply'' to see the changes.
 
==Creating mapcolors==
If you would like to create your own colors from scratch—this is advised against for topographical maps, which should follow the [[Wikipedia:WikiProject Maps/Conventions| map conventions]]—you can do so by following these steps on a layer which has not had colors loaded onto it:
 
# Access the ''Layer Properties''.
# Under the ''Symbology'' tab, change ''Single band properties > Color map'' from ''Grayscale'' to ''Colormap''. This will enable the options in the ''Colormap'' tab.
# In the ''Colormap'' tab, use the ''Add entry'' button to add colors. They will all have default values.
# Double click on the ''Value'', ''Color'', or ''Label'' fields of the entries to change them. For topography, the ''Value'' will be the altitude (ex.: 100 for 100m, 250 for 250m, and so on).
# ''Apply'' or ''OK'' to see the changes.
 
==Saving mapcolors==
You can save edited or created mapcolors as a style file by clicking ''Save Style...'' at the bottom of the ''Layer Properties'' window. This will allow you to apply those mapcolors to another map. If you would like to make colors—whether loaded or created—the default colors for the map, click ''Save As Default''. This will allow you to keep editing or loading different colors while having the option to ''Restore Default Style'' if you don't like the changes you've made.
 
==Existing color palettes==
The [[Wikipedia:Graphic Lab/Resources/QGis mapcolor files|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''' and follow the steps above to load it into your map.
 
=Step 5: Output your map, ''aka'' using the Print composer=
[[file:QGis Print composer output - 11 bitmap (png).png|right|300px|thumb|What we want is this: a high quality topographic output. With QGis and experience, you can get this in about 5 to 10 minutes.]]
You are now working with QGis, your GIS data—namely, ETOPO1—and your customized palette. To output your first topographic background, '''don't use ''File > Save as Image'', which is a simple screenshot.''' For better quality, use the ''Print composer''. This step will walk you through outputting a map like the one you see on the right, including a grid and an inset that lets the viewer know where in the world this section is located.
 
;Background
# To give a smooth, gradient-like appearance to the colors, go to ''Layer > Properties > Colormap > Color interpolation'' (at the top), and set it to ''Linear''.
# By default, the canvas of QGIS (geographic area visible in QGis) will become the area of interest for print composer.
# Open the ''Print composer'': ''QGIS (1.7)> File > New Print Composer (Ctrl + P)''.
 
==Placing the main section for output==
In the print composer:
# On the right, under ''General'', you can change the ''Size'' and ''Orientation'' of the image you will be outputting. A larger paper size and [[dots per inch|dpi]] means a higher quality, but don't go overboard! You don't want to end up with a huge file size that takes forever to upload and download.
# To add your map, you can either go to ''Layout > Add Map'' or click the ''Add new map'' icon in the toolbar.
# Click and drag in a diagonal motion across the white area to place your map. You can move it around and resize it once it's placed.
 
==Adding a grid==
# Make sure the placed map is selected—you will see four squares in the corners of the image when it is.
# On the right, go to the ''Item'' tab.
# Click on ''Grid'' and check the ''Show grid?'' option.
# Increase the ''Interval X'' and ''Interval Y'' fields. You can play around with the ''Offset X'' and ''Offset Y'' options, as well as the ''Grid type'' and ''Line color'', until you get a grid you like. You can also turn on and change options for the border annotations.
 
==Adding a localizer inset==
{{in progress}}
# step
# step
# step
Go to ''File > Export as Image'' or ''PDF'' or ''SVG'' (warning, SVG export is somewhat dodgy) and you have yourself a high quality topographic background!
 
==Visual step-by-step==
{{in progress}}
<gallery widths="600px" heights="300px" align="center">
file:QGis Print composer output - 00 starting point.png|0. Starting point (QGIS, not Pront composer): Data are ready an using the correct colormap.
file:QGis Print composer output - 01 map size.png|01. File > New Print composer (Ctrl+P) > (you have a white page) > icon 'Add new map' > draw the diagonal of the area for your map
file:QGis Print composer output - 02 page size.png|02. Choice the page size (mm) and quality (dpi) : higher means better quality.
file:QGis Print composer output - 03 map centering.png|03. Centering the map
file:QGis Print composer output - 04 map Grid tab, show grid.png|04. Grid tab, add grid.
file:QGis Print composer output - 05 map Grid tab, show annotations.png|05. Grid tab, add annotations
file:QGis Print composer output - 06 localizator starting point (WRONG).png|06. Starting point for the localizator BUT white border in the tab : this is troublesome.
file:QGis Print composer output - 06 localizator starting point (correct).png|06. Starting point for the localizator without white in the maptab : Great !
file:QGis Print composer output - 07 localizator added.png|07. icon 'Add new map' > draw the diagonal of the area for your map (same than 01)
file:QGis Print composer output - 08 localizator red frame.png|08. Icon 'Add basic shape' > trace a shape > change to rectangle
file:QGis Print composer output - 09 Final look.png|09. Final look.
file:QGis Print composer output - 10 Final save.png|10. Save as png.
file:QGis Print composer output - 11 bitmap (png).png|11. QGis Print composer's Final high quality output (you can zoom in !)
</gallery>
 
=Links=