This tutorial gives a basic overview of Coordinate Reference Systems and QGIS tools for working with them. You will try these tools in Tutorials 2 and 3, so it is highly recommended to read this before you start working on next tutorials to have a better understanding of what you are doing.
Tip
QGIS removed the option to turn off 'on-the-fly' projection, now it is always turned on. Please ignore the parts of the tutorials where you are suggested to turn it off or do something with it and just know that there is such a technology. This will be fixed in future revisions of the tutorials.
A Coordinate Reference System, or CRS, is a method of associating numerical coordinates with a position on the surface of the Earth. QGIS has support for approximately 7,000 standard CRSs, each with different use cases, pros and cons! Choosing an appropriate reference system for your QGIS projects and data can be a complex task, but fortunately QGIS helps guide you through this choice, and makes working with different CRSs as transparent and accurate as possible.
QGIS has support for approximately 7,000 known CRSs. These standard CRSs
are based on those defined by the European Petroleum Search Group (EPSG)
and the Institut Geographique National de France (IGNF), and are made
available in QGIS through the underlying “Proj” projection library. Commonly,
these standard projections are identified through use of an authority:code
combination, where the authority is an organisation name such as “EPSG” or
“IGNF”, and the code is a unique number associated with a specific CRS. For
instance, the common WGS 84 latitude/longitude CRS is known by the identifier
EPSG:4326
, and the web mapping standard CRS is EPSG:3857
.
Custom, user-created CRSs are stored in a user CRS database. See official documentation for information on managing your custom coordinate reference systems.
In order to correctly project data into a specific target CRS, either your data
must contain information about its coordinate reference system or you will need
to manually assign the correct CRS to the layer. For PostGIS layers, QGIS uses
the spatial reference identifier that was specified when that PostGIS layer was
created. For data supported by OGR or GDAL, QGIS relies on the presence of a
recognized means of specifying the CRS. For instance, for the Shapefile format
this is a file containing the Well-Known Text (WKT)
representation of the layer’s CRS. This projection file has the same base name as the
.shp
file and a .prj
extension. For example,
alaska.shp
would have a corresponding projection file named
alaska.prj
.
Whenever a layer is loaded into QGIS, QGIS attempts to automatically determine the correct CRS for that layer. In some cases this is not possible, e.g. when a layer has been provided without retaining this information. Whenever QGIS cannot automatically determine the correct CRS for a layer, it will prompt you to manually select the CRS. Selecting the correct choice is crucial, as a wrong choice will place your layer in the wrong position on the Earth’s surface! Sometimes, accompanying metadata will describe the correct CRS for a layer, in other cases you will need to contact the original author of the data to determine the correct CRS to use.
Every project in QGIS also has an associated Coordinate Reference System. The project CRS determines how data is projected from its underlying raw coordinates to the flat map rendered within your QGIS map canvas. Behind the scenes, QGIS transparently reprojects all layers contained within your project into the project’s CRS, so that they will all be rendered in the correct position with respect to each other!
It is important to make an appropriate choice of CRS for your QGIS projects. Choosing an inappropriate CRS can cause your maps to look distorted, and poorly reflect the real-world relative sizes and positions of features. Usually, while working in smaller geographic areas, there will be a number of standard CRSs used within a particular country or administrative area. It’s important to research which CRSs are appropriate or standard choices for the area you are mapping, and ensure that your QGIS project follows these standards.
The project CRS can be set through the CRS tab of the Project properties dialog ( ). It will also be shown in the lower-right of the QGIS status bar.
Project Properties Dialog
The CRS tab also has an optional setting for No projection. Checking this setting will disable ALL projection handling within the QGIS project, causing all layer and map coordinates to be treated as simple 2D Cartesian coordinates, with no relation to positions on the Earth’s surface.
Whenever you select a new CRS for your QGIS project, the measurement units will automatically be changed in the General tab of the Project properties dialog ( ) to match the selected CRS. For instance, some CRSs define their coordinates in feet instead of meters, so setting your QGIS project to one of these CRSs will also set your project to measure using feet by default.
By default, QGIS starts each new project using a global default projection. This
default CRS is EPSG:4326
(also known as “WGS 84”), and it is a global latitude/longitude based
reference system. This default CRS can be changed via the CRS for New Projects
setting in the CRS tab under
Options. There is an option to automatically set the project’s CRS
to match the CRS of the first layer loaded into a new project, or alternatively
you can select a different default CRS to use for all newly created projects.
This choice will be saved for use in subsequent QGIS sessions.
The CRS tab in the QGIS Options Dialog
When you use layers that do not have a CRS, you can define how QGIS
responds to these layers. This can be done globally in the
CRS tab under
Options.
The options shown in figure_projection_options are:
If you want to define the Coordinate Reference System for a certain layer without CRS information, you can also do that in the Source tab of the raster and vector properties dialog (see Source Properties for rasters and Source Properties for vectors). If your layer already has a CRS defined, it will be displayed as shown in Source tab in vector Layer Properties dialog. Note that changing the CRS in this setting does not alter the underlying data source in any way, rather it just changes how QGIS interprets the raw coordinates from the layer in the current QGIS project only.
Tip
CRS in the Layers Panel
Right-clicking on a layer in the Layers Panel (section Layers Panel) provides two CRS shortcuts. Set layer CRS takes you directly to the Coordinate Reference System Selector dialog (see figure_projection_project). Set project CRS from Layer redefines the project CRS using the layer’s CRS.
QGIS supports “on the fly” CRS transformation for both raster and vector data. This means that regardless of the underlying CRS of particular map layers in your project, they will always be automatically transformed into the common CRS defined for your project.
This dialog helps you assign a Coordinate Reference System to a project or a layer, provided a set of projection databases. Items in the dialog are:
The CRS selector also shows a rough preview of the geographic area for which a selected CRS is valid for use. Many CRSs are designed only for use in small geographic areas, and you should not use these outside of the area they were designed for. The preview map shades an approximate area of use whenever a CRS is selected from the list. In addition, this preview map also shows an indicator of the current main canvas map extent.
In QGIS, ‘on-the-fly’ CRS transformation is enabled by default, meaning that whenever you use layers with different coordinate systems QGIS transparently reprojects them to the project CRS. For some CRS, there are a number of possible transforms available to reproject to the project’s CRS! QGIS optionally allows you to define a particular transformation to use, otherwise QGIS uses a default one.
This customization is done in the
Options –> CRS tab menu under the Default datum
transformations group:
using Ask for datum transformation if several are
available: when more than one appropriate datum transformation exists for a
source/destination CRS combination, a dialog will automatically be opened
prompting users to choose which of these datum transformations to use for
the project;
or predefining a list of the appropriate default transformations to use when loading layers to projects or reprojecting a layer.
Use the button to open the Select Datum Transformations
dialog. Then:
Indicate the Source CRS of the layer, using the drop-down menu
or the Select CRS widget.
Likewise, provide the Destination CRS.
Depending on the transform grid files (based on GDAL and PROJ version installed on your system), a list of available transformations from source to destination is built in the table. Clicking a row shows details on the settings applied (epsg code, accuracy of the transform, number of stations involved…).
You can choose to only display current valid transformations by checking
the Hide deprecated option.
Find your preferred transformation, select it and click OK.
A new row is added to the table under
with information about ‘Source CRS’ and ‘Destination CRS’ as well as ‘Source datum transform’ and ‘Destination datum transform’.From now, QGIS automatically uses the selected datum transformation for
further transformation between these two CRSs until you remove
it from the list or
replace it with another one.
Selecting a preferred default datum transformation
Datum transformations set in the
Options –> CRS tab will be inherited by all new QGIS
projects created on the system. Additionally, a particular project
may have its own specific set of transformations specified via the
CRS tab of the Project properties dialog
( ). These settings apply
to the current project only.
Tip
QGIS removed the option to turn off 'on-the-fly' projection, now it is always turned on. Please ignore the parts of the tutorials where you are suggested to turn it off or do something with it and just know that there is such a technology. This will be fixed in future revisions of the tutorials.
The goal for this lesson: To reproject and transform vector datasets.
The CRS that all the data as well as the map itself from Lab 2 Tutorial 3 is called WGS84. This is a very common Geographic Coordinate System (GCS) for representing data. But there’s a problem, as we will see.
Download the data in this zip-archive
world/world.qgs
Notice the scale changing? That’s because you’re moving away from the one point that you zoomed into at 1:5 000 000, which was at the center of your screen. All around that point, the scale is different.
To understand why, think about a globe of the Earth. It has lines running along it from North to South. These longitude lines are far apart at the equator, but they meet at the poles.
In a GCS, you’re working on this sphere, but your screen is flat. When you try to represent the sphere on a flat surface, distortion occurs, similar to what would happen if you cut open a tennis ball and tried to flatten it out. What this means on a map is that the longitude lines stay equally far apart from each other, even at the poles (where they are supposed to meet). This means that, as you travel away from the equator on your map, the scale of the objects that you see gets larger and larger. What this means for us, practically, is that there is no constant scale on our map!
To solve this, let’s use a Projected Coordinate System (PCS) instead. A PCS “projects” or converts the data in a way that makes allowance for the scale change and corrects it. Therefore, to keep the scale constant, we should reproject our data to use a PCS.
By default, QGIS reprojects data “on the fly”. What this means is that even if the data itself is in another CRS, QGIS can project it as if it were in a CRS of your choice.
You can change the CRS of the project by clicking on button
in the bottom right corner of QGIS.
In the dialog that appears, type the word global
into the Filter
field. One CRS (NSIDC EASE-Grid 2.0 Global, EPSG:6933) should
appear in the list below.
Click on the NSIDC EASE-Grid 2.0 Global to select it, then click OK.
Notice how the shape of South Africa changes. All projections work by changing the apparent shapes of objects on Earth.
Zoom in to a scale of 1:5 000 000 again, as before.
Pan around the map.
Notice how the scale stays the same!
“On the fly” reprojection is also used for combining datasets that are in different CRSs.
world/RSA.shp
.EPSG:3410
.What do you notice?
The layer is visible even if it has a different CRS from the continents one.
Sometimes you need to export an existing dataset in another CRS. As we will see in the next lesson, if you need to make some distance calculations on layer, it is always better to have the layer in a projected coordinate system.
Be aware that the ‘on the fly’ reprojection is related to the project and not to single layers. This means that layers can have different CRS from the project even if you see them in the correct position.
But you can easily export the layer in another CRS.
Open the map from Lab 2 Tutorial 3.
Right-click on the buildings layer in the Layers panel
Select Save Vector Layer as… dialog.
in the menu that appears. You will be shown theClick on the Browse button next to the File name field
Specify the name of the new layer as buildings_reprojected.shp.
We must change the value of the CRS. Only the recent CRSs used will
be shown in the drop down menu.
Click on the button next to the dropdown menu.
The CRS Selector dialog will now appear.
In its Filter field, search for 34S
.
Select WGS 84 / UTM zone 34S from the list
Leave the other options unchanged. The Save Vector Layer as… dialog now looks like this:
Click OK
You can now compare the old and new projections of the layer and see that they are in two different CRS but they are still overlapping.
There are many more projections than just those included in QGIS by default. You can also create your own projections.
Start a new map
Load the world/oceans.shp
dataset
Go to
and you’ll see this dialog.An interesting projection to use is called Van der Grinten I
.
Enter its name in the Name field.
This projection represents the Earth on a circular field instead of a rectangular one, as most other projections do.
Add the following string in the Parameters field:
+proj=vandg +lon_0=0 +x_0=0 +y_0=0 +R_A +a=6371000 +b=6371000 +units=m +no_defs
Click OK
Choose your newly defined projection (search for its name in the Filter field)
On applying this projection, the map will be reprojected thus:
Different projections are useful for different purposes. By choosing the correct projection, you can ensure that the features on your map are being represented accurately.
Some materials for this lesson were taken from this article.
Further information on Coordinate Reference Systems is available here.
Tip
QGIS removed the option to turn off 'on-the-fly' projection, now it is always turned on. Please ignore the parts of the tutorials where you are suggested to turn it off or do something with it and just know that there is such a technology. This will be fixed in future revisions of the tutorials.
Map projections - or Coordinate Reference System (CRS) - often cause a lot of frustration when working with GIS data. But proper understanding of the concepts and access to the right tools will make it much easier to deal with projections. In this tutorial, we will explore how projections work in QGIS and learn about tools available for vector and rasters - particularly re-projecting vector and raster data, enabling on-the-fly re-projection and assigning projection to data without projection.
The task is to re-project and overlay data layers of difference projections together in QGIS.
.tfw
files to georeference to rasters.Natural Earth has Admin 0 - Countries dataset. Download the countries
UK’s Ordnance Survey provides open data for download. Download the MiniScale raster product for Great Britain and extract it to a folder on your computer.
Note
You will need to enter your personal details to be able to download the Ordnance Survey dataset.
For convenience, you may directly download a copy of the dataset from the link below:
minisc_gb.zip (Contains only the files required for this tutorial)
Data Sources: [NATURALEARTH] [OSOPENDATA]
ne_10m_admin_0_countries.zip
file and click
Open.ne_10m_admin_0_countries
layer and select Properties.ne_10m_admin_0_countries
layer and select
Save As.united_states.shp
. Also check the Save only selected
features box. This will ensure that only the selected feature gets
re-projected and exported. Next, we choose the new projection for the layer.
Click on the Select CRS button.north america
in the Filter search box. Scroll through the
results and select North_America_Albers_Equal_Area_Conic (EPSG:102008)
projection and click OK.Note
We choose Albers Equal Area Conic projection for this tutorial as it is a popular projection choice for thematic maps of the US. The choice of projection for your particular use-case will depend on a lot of factors. See this guide for a good overview of Projections.
united_states
layer overlays perfectly on top of
ne_10m_admin_0_countries
layer - even though they are in different
projections. This is because QGIS has a feature called On-the-fly CRS
transformation. The projection text at the bottom-right of QGIS now has
the words OTF
next the EPSG:4326`. To learn more, let’s
explore the CRS option in QGIS.North_America_Albers_Equal_Area_Conic
and the coordinates and scale are
different now. Right-click the united_states
layer and select
Zoom to Layer.ne_10m_admin_0_countries
do not appear on the canvas
as they are in a different coordinate space than the united_states
layer. Go back to the Project Properties dialog and turn-on the
Enable ‘on the fly’ CRS transformation option for the remainder
of the tutorial.minisc_gb.zip
file. Locate the
RGB_TIF_COMPRESSED
folder containing tif files. You will notice that
the .tif image files are plain TIF files, not GeoTIFF files. That means
they do not have any projection information. To use these images
in a GIS, you need to georeference them. A georeference contains 2 types of
information - image extents and projection. Typically, the extents are
stored in a file known as World file and they have extensions like
.tfw
or .jgw
. Most GIS software, including QGIS would be able to
use information stored in the world files as long as they are stored in the
same directory as the original image and has the same name. The .tfw
files for the MiniScale raster files are in a separate folder named
georeferencing_files
.ESRI_TFW_FILES
folder within georeferencing_files
. The
.tfw
files are plain text files. Open one of the .tfw
files in a
text editor.Line 1: A: pixel size in the x-direction in map units/pixel
Line 2: D: rotation about y-axis
Line 3: B: rotation about x-axis
Line 4: E: pixel size in the y-direction in map units
Line 5: C: x-coordinate of the center of the upper left pixel
Line 6: F: y-coordinate of the center of the upper left pixel
MiniScale_(standard)_R17.tfw
file from the
georeferencing_files
folder to the RGB_TIF_COMPRESSED
folder. This
way the .tfw
and the .tif
files are in the same directory and QGIS
can use the information.MiniScale_(standard)_R17.tif
file and
click Open.british national
and pick the OSGB 1936 / British National Grid
(EPSG:27700)
CRS. Click OK.MiniScale_(standard)_R17
layer is loaded, right-click on it
and select Zoom to layer.ne_10m_admin_0_countries
vector layer. Since we have the OTF
enabled with EPSG:4326, the MiniScale_(standard)_R17
layer gets
dynamically reprojected to EPSG:4326 and shown in the same coordinate space
as the other layer.A Web Mapping Service (WMS) is a service hosted on a remote server. Similar to a website, you can access it as long as you have a connection to the server. Using QGIS, you can load a WMS directly into your existing map.
It is possible to load a raster image into a map, from Google, for example. However, this is a once-off transaction: once you have downloaded the image, it doesn’t change. A WMS is different in that it’s a live service that will automatically refresh its view if you pan or zoom on the map.
The goal for this lesson: To use a WMS and understand its limitations.
For this exercise, you can either use the result of Lab 2 Tutorial 3 or use again this base map, or just start a new map and load some existing layers into it. For this example, we used a new map and loaded the original places and landuse layers and adjusted the symbology:
Load these layers into a new map, or use your original map with only these layers visible.
Before starting to add the WMS layer, first deactivate “on the fly” projection. This may cause the layers to no longer overlap properly, but don’t worry: we’ll fix that later.
To add WMS layers, click on the Add WMS Layer button:
You’ll need a WMS address to continue. There are several free WMS servers available on the Internet. One of these is terrestris, which makes use of the OpenStreetMap dataset.
To make use of this WMS, set it up in your current dialog, like this:
The value of the Name field should be terrestris
.
The value of the URL field should be
http://ows.terrestris.de/osm/service
.
Click OK. You should see the new WMS server listed:
Click Connect. In the list below, you should now see these new entries loaded:
These are all the layers hosted by this WMS server.
Click once on the OSM-WMS layer. This will display its Coordinate Reference System:
Since we’re not using WGS 84
for our map, let’s see all the CRSs we have
to choose from.
Click the Change button. You will see a standard Coordinate Reference System Selector dialog.
We want a projected CRS, so let’s choose WGS 84 / Pseudo Mercator.
Click OK.
Click Add and the new layer will appear in your map as OSM-WMS.
In the Layers list, click and drag it to the bottom of the list.
You will notice that your layers aren’t located correctly. This is because “on the fly” projection is disabled. Let’s enable it again, but using the same projection as the OSM-WMS layer, which is WGS 84 / Pseudo Mercator.
Enable “on the fly” projection.
In the CRS tab (Project Properties dialog), enter the
value pseudo
in the Filter field:
Choose WGS 84 / Pseudo Mercator from the list.
Click OK.
Now right-click on one of your own layers in the Layers list and click Zoom to layer extent. You should see the Swellendam area:
Note how the WMS layer’s streets and our own streets overlap. That’s a good sign!
By now you may have noticed that this WMS layer actually has many features in it. It has streets, rivers, nature reserves, and so on. What’s more, even though it looks like it’s made up of vectors, it seems to be a raster, but you can’t change its symbology. Why is that?
This is how a WMS works: it’s a map, similar to a normal map on paper, that you receive as an image. What usually happens is that you have vector layers, which QGIS renders as a map. But using a WMS, those vector layers are on the WMS server, which renders it as a map and sends that map to you as an image. QGIS can display this image, but can’t change its symbology, because all that is handled on the server.
This has several advantages, because you don’t need to worry about the symbology. It’s already worked out, and should be nice to look at on any competently designed WMS.
On the other hand, you can’t change the symbology if you don’t like it, and if things change on the WMS server, then they’ll change on your map as well. This is why you sometimes want to use a Web Feature Service (WFS) instead, which gives you vector layers separately, and not as part of a WMS-style map.
This will be covered in the next lesson, however. First, let’s add another WMS layer from the terrestris WMS server.
Hide the OSM-WSM layer in the Layers list.
Add the “ZAF CGS 1M Bedrock Lithostratigraphy” WMS server at this URL:
http://196.33.85.22/cgi-bin/ZAF_CGS_Bedrock_Geology/wms
Load the BEDROCKGEOLOGY layer into the map (use the Add WMS Layer button as before). Remember to check that it’s in the same WGS 84 / World Mercator projection as the rest of your map!
You might want to set its Encoding to JPEG and its
Tile size option to 200
by 200
, so that it loads
faster:
http://ogc.gbif.org:80/wms
The purpose with the task is to study projected reference systems and to explore the content of online map services. Open QGIS and add the three layers of the world map from this zip-archive. Change symbology to suitable colors. Check that the layers are in WGS 84. Change the CRS to your national projected system (or a system for a country nearby).
Did you notice any change in the form of your country? Maybe there are several projection files that you can switch between? Take a look at the different options!
Continue by exploring the quality of WMS maps for your home country. Change the country polygons to hollow in order to see the maps and borders together. Search for a WMS map which could be interesting for your area of interests. Mention in the report how this map is relevant to you. You can start your search from https://wiki.openstreetmap.org/wiki/WMS or http://geopole.org/ or just use your favorite search engine.
Next task is to chose one of the available UTM projections that has a central meridian located in your home country. Choose WGS 84 and a zone that has its centre in you country. Try also to find the location for the origo of the coordinate system on the map, probably it will be somewhere on the equator. Try to understand the meaning of the different parameters in the chosen projection by studying the theory pages and documentation!
Finish the home assignment by making a map layout with a map that shows one of the WMS maps covering your home country in your national projected coordinate system at a suitable scale with an even number (e.g 1: 2 000 000).
Insert the information about the projection parameters on the layout, and if possible, explain those parameters to the reader in a textbox. The layout should also contain a headline, your name, scale text and north arrow. A legend may be not necessary.
Add also the outlines of the world map to the layout to make it possible to compare the consistency of the different map layers.
Literature: Understanding Map Projections. A pdf-document stored in the folder S:\ArcGIS\tnk055\literature