Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Filter by Categories
ArcGIS Pro

Drawing Lines and Adding Attributes in QGIS

Drawing Lines and Adding Attributes in QGIS: A Comprehensive Guide

In this post, we will discuss the importance of creating a layer before drawing features, and how to create a layer that can host your line or shape data. We will provide step-by-step instructions on drawing a line in QGIS and explain the reasons for adding additional fields (attributes) to your layers. Attributes play a crucial role in data organization, analysis, visualization, and editing, making them an essential part of any GIS project.

Want to stay ahead of the GIS curve? Listen to our podcast!

Step-by-step instructions to draw a line in QGIS:

  1. Open QGIS.
  2. Go to Layer > Create Layer > New Geopackage Layer (or New Shapefile Layer).
  3. Choose a location to save the file and give it a name.
  4. Under Geometry Type, select “LineString” to create a line layer.
  5. (Optional) Add additional fields (attributes) if necessary.
  6. Click “OK” to create the new layer. It should now appear in your Layers Panel.
  7. Select the newly created layer in the Layers Panel.
  8. Click the yellow pencil icon on the toolbar to enable editing (toggle editing) for the selected layer.
  9. Now, you should see an “Add Line Feature” icon (a pencil drawing a line) in the toolbar. Click on it.
  10. Your cursor will change into a crosshair. Click the left mouse button on the map canvas to start drawing the line at the desired starting point.
  11. Continue clicking the left mouse button to add vertices (points) along the line.
  12. To finish drawing the line, right-click once. A dialog box may appear asking you to fill out attribute information if you added fields earlier. Fill out the information and click “OK.”
  13. Click the “Save Layer Edits” disk icon in the toolbar to save your changes to the layer.
  14. To exit editing mode, click the yellow pencil icon again to toggle editing off.

Note that these steps may vary slightly depending on the version of QGIS you are using.

Creating a layer first is important

Creating a layer first is important in QGIS because it serves as a container to host and organize geographic data, such as points, lines, or polygons. In QGIS, geographic data is organized and managed in layers, each of which can store a specific type of geometry and attributes.

When you create a layer, you define its properties, such as the geometry type, coordinate reference system (CRS), and any additional fields (attributes) that you may want to associate with the features in that layer. Without a layer, there is no structure to store the geographic data or a way to manage it within the QGIS environment.

Layers in QGIS can be individually styled, filtered, and manipulated without affecting other layers, allowing for more flexibility and control over your map and data. By creating a layer first, you ensure that the features you draw have a proper structure and can be effectively managed and analyzed within QGIS.

Add additional fields (attributes)

Adding additional fields (attributes) to a layer in QGIS allows you to store extra information about the features within that layer. Each field represents a specific property or characteristic that you want to associate with the features. For example, if you are working with a layer of points representing cities, you might want to add fields for population, area, or country name.

Attributes are useful for several reasons:

  1. Data organization: Attributes help organize and categorize your geographic data, making it easier to understand and analyze.
  2. Data analysis: You can use attribute values to perform queries, selections, and spatial analyses. For example, you might want to find all cities with a population greater than one million or calculate the average area of cities within a specific country.
  3. Data visualization: Attributes can be used to symbolize features on a map based on their properties. For example, you can create a graduated or categorized symbolization where the size or color of the points represents the population size or category of each city.
  4. Data editing: Having attribute information associated with features allows you to edit or update the information more easily. You can change the values of the attributes in the attribute table or use field calculator expressions.

To add additional fields (attributes) to a layer in QGIS, follow these steps:

  1. When creating a new layer (Layer > Create Layer > New Geopackage Layer or New Shapefile Layer), you will see a section called “Fields” in the dialog box.
  2. Click the “Add Field” button (a green “+” icon) to create a new field.
  3. Enter a name for the field in the “Name” box.
  4. Choose the appropriate data type for the field from the “Type” dropdown menu. Data types include Text, Integer, Decimal, and Date.
  5. Set the field’s width and precision, if applicable, in the “Width” and “Precision” boxes.
  6. Click “OK” to add the field to the layer’s field list.
  7. Repeat the steps for any additional fields you want to add.
  8. Complete the process of creating the layer by specifying other required properties and clicking “OK”.

When you add features to the layer, you will be prompted to enter values for these fields, which can then be viewed and edited in the layer’s attribute table.

About the Author
I'm Daniel O'Donohue, the voice and creator behind The MapScaping Podcast ( A podcast for the geospatial community ). With a professional background as a geospatial specialist, I've spent years harnessing the power of spatial to unravel the complexities of our world, one layer at a time.

Leave a Reply