VOOZH about

URL: https://www.geeksforgeeks.org/dbms/spatial-and-geographical-data/

⇱ Spatial and Geographical data - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Spatial and Geographical data

Last Updated : 9 Dec, 2025

Today, many applications deal with information that is related to locations, shapes, maps, and geographical features. A normal database cannot efficiently handle such location-based information. That’s where spatial data and spatial databases come into the picture. 

Spatial Data

Spatial data is data that represents objects in physical space — anything that has a shape, size, or position on Earth.

Examples:

  • A building shown on a digital map
  • A road, river, or boundary line
  • A satellite image
  • The outline of a country, state, or city

Normal indexes (like B-Trees or hashing) cannot efficiently answer questions such as:

“Find all buildings that lie inside this area”
“Show all roads that intersect this route”
“Which houses are within 5 km of this point?”

To handle such queries, databases need special spatial index structures like R-trees.

Types of Spatial Data

1. Raster Data

Raster = grid of pixels (like a photo or image).
Each pixel has an associated value (color, elevation, temperature, etc.)

Examples:

  • Satellite images
  • Scanned maps
  • Digital photos
  • Heatmaps showing rainfall or temperature

Think of raster as an image divided into tiny squares.

2. Vector Data

Vector = geometric shapes that represent real-world objects.

Examples:

  • Points → Location of ATM, hotel, shop
  • Lines → Roads, rivers, pipelines
  • Polygons → Buildings, countries, lakes
  • 3D shapes → Cylinders, cuboids used in 3D modeling

Vector data is more precise and structured than raster data.

👁 Spatial-Data


Spatial Data in Computer-Aided Design (CAD)

CAD is used to design:

  • Machines
  • Cars
  • Buildings
  • Aircraft
  • Electronics (like integrated circuits)

Problems with old CAD systems:

  • Data stored in memory during editing
  • Everything had to be saved back to one big file
  • Even if you needed only a small part, you had to read the whole file
  • Large models (like an entire aircraft) couldn’t fit into memory

Solution: Object-Oriented Databases

OODBMS represent every component as an object.

Example:

  • Engine → object
  • Wing → object
  • Inner parts → objects connected to each other

This makes the design more organized, efficient, and scalable.

Spatial Data in Geographic Information Systems (GIS)

GIS stores and manages geographical data, such as:

  • Road maps
  • Land usage maps
  • Elevation maps
  • Political boundaries
  • Land ownership information
  • Soil type maps
  • Rainfall distribution maps

GIS data differs from CAD data:

  • CAD focuses on designing objects
  • GIS focuses on earth-related information like maps and satellite images

Applications

Microsoft SQL Server

Since SQL Server 2008, it supports spatial data types and spatial indexes.

You can store:

  • Points
  • Lines
  • Polygons
    And run queries like:

Find all locations within 10 km of this point.

CouchDB (with GeoCouch plugin)

CouchDB is a document-based NoSQL database.
GeoCouch plugin adds:

  • Spatial indexing
  • Geo-queries
  • Location-based search

Neo4j

Neo4j is a graph database.
It handles spatial data mainly for:

  • Pathfinding
  • Routing (like GPS navigation)
  • Graph-based map analysis

Example:

Find the shortest route between two locations.


Comment
Article Tags:
Article Tags:

Explore