Book Image

QGIS 2 Cookbook

By : Alex Mandel, Víctor Olaya Ferrero, Anita Graser, Alexander Bruy
Book Image

QGIS 2 Cookbook

By: Alex Mandel, Víctor Olaya Ferrero, Anita Graser, Alexander Bruy

Overview of this book

QGIS is a user-friendly, cross-platform desktop geographic information system used to make maps and analyze spatial data. QGIS allows users to understand, question, interpret, and visualize spatial data in many ways that reveal relationships, patterns, and trends in the form of maps. This book is a collection of simple to advanced techniques that are needed in everyday geospatial work, and shows how to accomplish them with QGIS. You will begin by understanding the different types of data management techniques, as well as how data exploration works. You will then learn how to perform classic vector and raster analysis with QGIS, apart from creating time-based visualizations. Finally, you will learn how to create interactive and visually appealing maps with custom cartography. By the end of this book, you will have all the necessary knowledge to handle spatial data management, exploration, and visualization tasks in QGIS.
Table of Contents (19 chapters)
QGIS 2 Cookbook
About the Authors
About the Reviewers

Reprojecting a layer

Layers may be in a CRS other than the one that is best for a given task. Although QGIS supports on-the-fly reprojection when rendering, other tasks, such as performing spatial analysis, may require using a given CRS or having all input layers in the same one. This recipe shows you how to reproject a vector layer.

Getting ready

Open the layer named Davis_DBO_centerline.shp from the sample dataset.

How to do it…

The Davis_DBO_centerline.shp layer uses a CRS with feet as the unit, which makes this unsuitable for certain operations. We plan to use this layer in future recipes to calculate routes and work in metric units, so including this in a CRS that uses them is then a much better option:

  1. Right-click on the layer name in the table of contents and select Save as....

  2. Select Selected CRS in the drop-down list to specify a different output CRS. Click on the Browse button to select a CRS. You will see the CRS selector dialog.

  3. You will be converting the point to the EPSG:26911 CRS. Use the filter box to find it among the list of available CRSs and select it. Then click on OK.

  4. Click on OK in the Save as dialog to create the layer. A new shapefile will be created with the projected lines.

How it works…

Reprojecting is done by the OGR library when it saves the file because this is one of the options that it supports.

There's more…

Raster layers can be reprojected in a similar way:

  1. In the Save as dialog, for raster layers, you can find a CRS field with a Browse button.

  2. Click on it to open the CRS selector, and select the destination CRS.

  3. When you click on OK, the raster layer will be exported using the selected CRS instead of its original one.