📍QGISBeginner⏱️ 3 mins read

Vector Data: Points, Lines & Polygons Explained

Published by GISTECHNEWS Editorial Team • Peer-Reviewed & Verified on QGIS 3.34+ LTR & Python 3.10+

Vector data represents real-world entities through discrete geometric primitives governed by the Open Geospatial Consortium (OGC) Simple Feature Access standards. Every vector feature is stored as a set of geographic vertex coordinates paired with relational attributes. Understanding how points, lines, and polygons behave—along with the structural limitations of legacy file formats like ESRI Shapefiles versus modern OGC GeoPackages—is critical for maintaining topological integrity and data hygiene throughout your spatial analysis pipelines.

📋 Prerequisites

  • QGIS 3.34+ LTR installed.
  • Basic understanding of coordinate systems (X, Y coordinates).
  • Sample vector dataset (GeoPackage or Shapefile).

🛠️ Technical Environment

Required Software: QGIS / GeoPandas (Recommended: 3.34+ LTR)

Practice Dataset: Road Infrastructure & Parcels

Source Portal: OpenStreetMap / Geofabrik

CRS / Format: EPSG:4326 (GeoPackage)

Step-by-Step Workflow & Methodological Execution

1

Module 1: The Three Geometric Primitives in Detail

Vector data is structured around three primary geometry families: 1. Point & MultiPoint: Represent zero-dimensional entities defined by a single coordinate pair (X, Y) or triplet (X, Y, Z for elevation). Used for sample boreholes, meteorological stations, GPS survey waypoints, and customer addresses. 2. LineString & MultiLineString: One-dimensional linear geometries formed by two or more connected vertices. Lines have length but zero planar area. Used for roads, railway tracks, pipelines, and contour lines. 3. Polygon & MultiPolygon: Two-dimensional planar geometries enclosed by one exterior linear boundary ring and zero or more interior rings (holes/islands). Polygons possess both perimeter length and enclosed area. Used for cadastral land boundaries, lakes, and administrative regions.

2

Module 2: Managing and Querying Attribute Tables

Right-click any vector layer in QGIS and choose 'Open Attribute Table' (F6). Each row corresponds to a single geometry, while columns represent defined data fields: • Data Types: Integer (whole numbers), Real/Double (floating-point decimals), String/Text (alphanumeric text), and Date. • Field Calculator: Allows creating new calculated fields using expressions. For example, to calculate parcel area in hectares: `$area / 10000`. • Conditional Expressions: You can categorize records dynamically: `CASE WHEN "population" > 100000 THEN 'Metropolitan' ELSE 'Rural' END`. • Selection Query (Select by Expression): Filter features using SQL-like syntax: `"ZONING" = 'Commercial' AND "AREA_SQM" >= 5000`.

3

Module 3: Shapefile Limitations vs The Modern GeoPackage Standard

For decades, the ESRI Shapefile (`.shp`) was the default GIS exchange format. However, Shapefiles carry severe legacy limitations: • Multi-file clutter: Requires at least 3 to 7 separate sidecar files (`.shp`, `.shx`, `.dbf`, `.prj`). Missing just one file corrupts the dataset. • 2 GB File Limit: The underlying dBase (.dbf) architecture crashes if files exceed 2 gigabytes. • 10-Character Field Name Cap: Column headers like `registration_date` get clipped to `registrati`. • Null Value Inaccuracies: Cannot differentiate between a zero (`0`) and a true `NULL` value. In contrast, the OGC GeoPackage (`.gpkg`) is a modern, open standard based on a single SQLite database file. It supports unlimited file size, full UTF-8 text, multiple vector and raster layers in one file, and built-in spatial R-Tree indexing for blazing performance.

⚠️ Common Errors & Troubleshooting

❌ Invalid geometry error when saving polygon edits

💡 Resolution: Run 'Check Validity' or 'Fix Geometries' algorithm in QGIS to resolve self-intersecting loops.

❌ DBF column names truncated to 10 characters

💡 Resolution: Migrate dataset from ESRI Shapefile to OGC GeoPackage to allow unlimited column lengths.

💡 Expert Tips & Best Practices

  • Store multiple related vector layers (points, lines, polygons) inside a single GeoPackage container for organized project packaging.
  • Use spatial indexing (R-Tree) on large vector layers with >10,000 features for fast pan and zoom rendering.

🐍 Python Shapely Geometry Creation & Validation

from shapely.geometry import Point, LineString, Polygon
from shapely.validation import explain_validity

# Create valid Point, LineString, and Polygon
pt = Point(10.5, 20.8)
line = LineString([(0, 0), (5, 5), (10, 2)])
poly = Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)])

print(f"Polygon Area: {poly.area} | Perimeter: {poly.length}")

# Simulate an invalid 'bowtie' polygon (self-intersecting edges)
invalid_poly = Polygon([(0, 0), (5, 5), (5, 0), (0, 5), (0, 0)])
print(f"Is Polygon Valid? {invalid_poly.is_valid}")
print(f"Validity Reason: {explain_validity(invalid_poly)}")

# Fix topology using modern Shapely / GEOS make_valid
from shapely import make_valid
fixed_geometry = make_valid(invalid_poly)
print(f"Repaired Geometry Type: {fixed_geometry.geom_type}")

🔗 Related Tutorials & Practical Workflows