QGIS – Practical 2


The practical has been tailored to QGIS 2.12, this may be different to the version you may be using and therefore may look different, but the concepts and tasks will be similar (though the tasks may need to be done in a different way).

Spatial Projections

-Download the files for the practical: Practical_2_data.zip. Unzip the files, and store them in a location of your choice.

-Open QGIS Desktop and open a new project from Project > New.

-Load the OpenStreetMap Basemap from Web > OpenLayers plugin > Add OpenStreetMap

-Add the raster image layer for the area, /Raster/peru_vegatation_and_weather_map_motified.tif, from where you downloaded the files for the practical, which can be done by selecting Layer > Add Raster Layer and browsing to the file. You may wish to Zoom to the Layer (right click the layer and select Zoom to Layer) and possibly adjust the transparency (right click the layer, select properties, and adjust the Global transparency [afterwards, click OK]).

-QGIS allows you to define a CRS (Coordinate Reference System) for layers as well as for the entire project. You will need to define the CRS for layers without a pre-defined one, which can happen if this information has not been set yet or has been lost. To define the project-wide CRS, select Project > Project Properties> CRS. In that window, tick the box next to Enable ‘on the fly’ CRS transformation, Filter for “PSAD56” and select PSAD56 (EPSG:24891). Similarly, you can select WGS 84 for the project-wide CRS.

(Note: At this point, if you are not in a familiar view in the map, right click the peru_vegetation_and_weather_map_modified.tif layer and select “Zoom to Layer” to go to it.)

-At the bottom of QGIS window, you will notice the label “Coordinate”. As you move your cursor over the map, it will show you the X,Y coordinates at that location. At the bottom-right corner you will see EPSG:24891 . This is the code for the current Project CRS PSAD56.

-Now switch back to WGS84 / Pseudo Mercator EPSG:3857 in the same way as you just did to change the Coordinate Reference System to PSAD56.

-Load a vector layer to the map. Select Layer > Add Vector Layer. Select /Vector/peru_administrative.shp from the files downloaded earlier. To determine the layer’s projection, right click on it and select Properties.

-In the Properties dialog, click on the Metadata tab. You will see the projection definition of the layer under Layer Spatial Reference System. You can see that the layer’s projection is WGS84.

-Let’s say you need to use data with no pre-set projection – what are the steps for setting a vector layer in the right projection? Open the layer peru_highway_no_projection from the folder /Vector/peru_highway_no_projection/peru_highway_no_projection.

-As the layer has no pre-defined projection, you will be asked to specify a coordinate reference system. Select WGS84 / Pseudo Mercator and click OK.

-Right-click on the peru_highway layer and select Zoom to Layer Extent; then zoom out. The layer will appear in the wrong place – South of Western Africa in the Atlantic Ocean.

(Note: It will be very small, looking almost like a small dot.)

-This is a common problem when working with data, as a projection may not have been set when the file was created. Ideally you would like to see the layers overlaid on top of each other in the same coordinate-space. In order to do this, first remove the layer you import and load it again. In the coordinate reference system selector, choose a different projection (WGS84) and click OK. You can see the layer is in the right place.

(Note: You may need to Zoom to your previous, familiar, view, which may be done by right clicking the peru_vegetation_and_weather_map_modified.tif layer and select “Zoom to Layer” to go to it.)

(Note: You may wish to turn layers on/off to better see other layers)

-In order to ensure that a dataset with no projection shows up in the right place, you may need to do this a few times and try a different coordinate reference system. Common ones for your work will be: WGS84 [EPSG: 4326] (e.g. GPS), WGS84 / Web Mercator [EPSG: 3857] (e.g. Google Maps), and PSAD56 [EPSG: 24891] (e.g. local Peruvian datasets). Should any agencies give you data without a coordinate reference system, you should be able to set that properly now.

QGIS – Practical 2

Leave a Reply

Your email address will not be published. Required fields are marked *