< All
...
Export

Data Collection, Querying, and Input

QGIS Documentation: Data Collection, Querying, and Input

1. Data Collection

Data collection in QGIS involves adding new spatial data to your project, either by creating new features or importing existing datasets. Here’s how you can collect data:

A. Adding New Features

  1. Enable Editing Mode:
  • To add new features, you must first enable editing mode for the layer you want to modify.
  • In the Layers Panel, right-click the layer and select Toggle Editing or use the Toggle Editing button in the toolbar.
  1. Select the Feature Creation Tool:
  • Choose the appropriate tool for creating new features from the Digitizing Toolbar. Options include:
    • Add Point Feature: Click to place a new point.
    • Add Line Feature: Click to create a line by clicking multiple points.
    • Add Polygon Feature: Click to create a polygon by defining its boundary with multiple clicks.
  1. Draw the Feature:
  • Click on the map canvas to place points or define lines and polygons. For polygons, complete the shape by closing the boundary (usually by right-clicking or double-clicking).
  1. Save Edits:
  • After creating your features, save the changes by clicking the Save Edits button on the Digitizing Toolbar or by right-clicking the layer in the Layers Panel and selecting Save Layer Edits.
  1. Disable Editing Mode:
  • Once you’ve saved your edits, disable editing mode by clicking the Toggle Editing button again.

B. Importing Data

  1. Import Vector Data:
  • Go to Layer > Add Layer > Add Vector Layer.
  • Browse to the file you want to import (e.g., shapefile, GeoJSON) and click Open.
  1. Import Raster Data:
  • Go to Layer > Add Layer > Add Raster Layer.
  • Browse to the raster file (e.g., TIFF, JPEG) and click Open.
  1. Add Web Services:
  • Go to Layer > Add Layer > Add WMS/WMTS Layer to connect to web map services.
  • Enter the URL of the service and connect to load the data into your project.

2. Querying Data

Querying data in QGIS allows you to extract specific information based on criteria or spatial relationships. There are several methods for querying data:

A. Using the Attribute Table

  1. Open Attribute Table:
  • Right-click the layer in the Layers Panel and select Open Attribute Table.
  1. Filter and Query:
  • Use the Select by Expression tool or the Query Builder to create queries based on attribute values. For example, you can query for all features where the population is greater than 10,000.
  1. Save Selected Features:
  • After querying, you can save the selected features to a new layer by right-clicking the layer and selecting Export > Save Selected Features As.

B. Using the Spatial Query Tool

  1. Open the Spatial Query Tool:
  • Go to Vector > Spatial Query.
  1. Set Parameters:
  • Define the spatial relationship (e.g., intersects, contains) and select the layers to query.
  1. Run the Query:
  • Execute the spatial query to select features based on spatial relationships. The results can be saved or further analyzed.

C. Using the Field Calculator

  1. Open Field Calculator:
  • In the Attribute Table, click the Field Calculator button.
  1. Create New Field or Update Existing Field:
  • Use expressions to calculate new values or update existing ones based on the attributes of the features. For example, you can calculate the area of polygons or derive new attributes from existing ones.
  1. Apply the Calculation:
  • Click OK to apply the calculations and update the layer’s attribute data.

3. Data Input

Data input in QGIS involves entering or modifying attribute data for features. This can be done through various methods:

A. Editing Attributes Directly

  1. Open Attribute Table:
  • Right-click the layer in the Layers Panel and select Open Attribute Table.
  1. Toggle Editing Mode:
  • Click the Toggle Editing Mode button in the Attribute Table.
  1. Edit Attributes:
  • Click on the cells you want to edit and enter the new values. You can also use the Field Calculator for batch updates.
  1. Save Edits:
  • Click the Save Edits button in the Attribute Table or on the Digitizing Toolbar.
  1. Disable Editing Mode:
  • Click the Toggle Editing Mode button again to exit editing mode.

B. Using Forms

  1. Open Form View:
  • Right-click a feature on the map and select Open Feature Form.
  1. Enter or Edit Data:
  • Use the form to input or modify attribute data for the selected feature.
  1. Save Changes:
  • Click OK to save the changes to the feature’s attributes.

By understanding and utilizing these methods for data collection, querying, and input in QGIS, you can effectively manage and analyze your spatial data to meet your project needs.