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.This work is licensed under a Creative Commons Attribution 4.0 International License