Quantum GIS (QGIS) Tutorials: Tutorial: Working with Projections in QGIS

Map projections 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 reprojecting vector and raster data, enabling on-the-fly reprojection and assigning projection to data without projection. vector data for this tutorial, particularly 10m_admin0_map_units layer. We will also use some raster data for the UK. I downloaded MiniScale raster layer from UK’s Let’s get familiar with basics of how projection is handled in QGIS. Projection is referred as Coordinate Reference System (CRS) or Spatial Reference System (SRS) within QGIS. Coordinate systems are categorized in 2 types: Geographic Coordinate Systems and Projected Coordinate Systems. Geographic Coordinate Systems use Latitude and Longitude as coordinates and use different ellipsoids. Projected Coordinate Systems project the ellipsoid to a surface and use various linear schemes to assign coordinates. Load the 10m_admin0_map_units.shp layer in QGIS via Layer → Add Vector Layer. 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:4326 . This is the code for the current ‘Project CRS’. In the Properties dialog, click on the Metadata tab. You will see the projection definition of the layer under ‘Layer Spatial Reference System’. In the Save vector dialog, first click on ‘Browse’ next to Save As label and name your output file admin_0_reprojected.shp. Next, click on the Browse button next to CRS label. Once the layer is loaded, you will see it on the table of contents. But you don’t see it on the canvas. This is because you are in the latitude/longitude coordinate space from the previous layer. The new layer has a different coordinate space, so it will be located somewhere off the current view. To see it, right click and click on ‘Zoom to layer extent’. Now you will see the newly reprojected layer. But you do not see the previous layer. This is a common problem when working with data of different projection. Ideally you would like to see the layers overlaid on top of each other in the same coordinate-space regardless of their projection. There is an option called ‘on-the-fly reprojection’ to enable just that. Check the box next to ‘Enable ‘on the fly’ CRS transformation’. Next select the ‘common’ projection that all the current and subsequent layers would be automatically reprojected to. We would keep that as WGS84. Click OK. Now let’s switch gears and add a raster layer to our project. You have to download the Miniscale layer, extract the zip file to a directory and locate 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 associated with that. To use any image in a GIS, you need 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. The projection information is stored as a ‘PRJ file’ and they have extension of .prj. Most GIS software, including QGIS would be able to use information stored in the world files and projection files as long as they are stored in the same directory as the original image and has the same name. So if your file is called foo.tif, your world file and projection file should be called foo.tfw and foo.prj. In the Miniscale layer, we have been supplied with the World files in a separate layer. (PDF) and determine that this image is georeferenced in the British National Grid projection. Locate it from the list and click OK. You will now see the newly added raster layer perfectly overlaid with our vector data. Remember that all these three layers are in a different projection and hence a different coordinate space, but because we have enabled ‘on the fly’ transformation, they are converted to a common coordinate space in real time. If you want to permanently assign the projection to the raster layer, use Raster → Assign projection tool. It will create a GeoTiff file from the original TIF file that will be self-contained with the extent and projection information. Hope you have learnt the basics of CRS and how QGIS handles it. Do let me know how you deal with projections in your project. Source.

Яндекс.Метрика Рейтинг@Mail.ru Free Web Counter
page counter
Last Modified: April 22, 2016 @ 4:02 pm