Chapter 4. Preparing Vector Data for Processing

Typically, raw data obtained for a GIS project needs to be massaged for use in the specific application. It may need to be merged, converted to a different geometry type, saved to the coordinate reference system of the project, subset to the extent of the study area, or subset by attribute values. While QGIS provides a powerful set of tools that can handle many types of vector preparation and transformation task, this chapter will cover what we consider to be commonly used vector preparation tasks. Many of the tools covered in this chapter are found on the Vector menu in QGIS; however, others are available in the Processing Toolbox. Additional vector processing tasks will be covered in Chapter 8, The Processing Toolbox and Chapter 9, Automating Workflows with the Graphical Modeler. The topics that we will cover in this chapter are as follows:

  • Merging shapefiles
  • Creating spatial indices
  • Checking for geometry errors
  • Converting vector geometries
  • Adding geometry columns
  • Using basic vector geoprocessing tools
  • Applying conditional formatting to attribute table cells
  • Advanced field calculations
  • Complex spatial and aspatial queries
  • Defining new coordinate reference systems (CRS)
  • Raster to vector format conversions

Note

Note that the QGIS development team is planning on eventually moving all the tools found under the Vector menu to the Processing Toolbox, but this isn't likely to happen until at least QGIS version 2.16.

Merging shapefiles

The Merge shapefiles to one tool merges (that is, combines) multiple input shapefiles into a new shapefile. The input shapefiles must be in a common coordinate reference system and should contain common attributes. For example, vector data is often provided in tiles or by political jurisdiction such as counties or states. In these cases, the data may need to be merged to form a seamless layer covering the study area. The Merge shapefiles to one tool that can be found by navigating to Vector | Data Management Tools will combine them:

Merging shapefiles

In the Merge shapefiles dialog, you have the option to choose whether you wish to merge all shapefiles in a folder or pick individual shapefiles to merge:

  1. Depending on how your shapefiles are stored, you can do either of the following:
    • Keep Select by layers in the folder unchecked to merge all shapefiles in a directory
    • Check Select by layers in the folder to select individual files to merge
  2. If the previous option is enabled, choose the shapefile type (Point, Line, or Polygon).
  3. Set the input directory/files by clicking on Browse.
  4. Name the output shapefile by clicking on Browse.
  5. Choose whether you wish to select Add result to map canvas.
  6. Click on OK to merge the shapefiles.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset