⭐ SPATIAL RELATIONSHIPS (Detailed Explanation)
Spatial relationships describe how two or more spatial objects (points, lines, polygons) relate to each other based on location, distance, geometry, and topology.
Spatial relationships are fundamental in:
✔ Spatial databases
✔ GIS systems
✔ Location-based analysis
✔ Mapping applications
✔ Routing & navigation
✔ Geographic analytics
These relationships allow queries like:
- “Which hotels are near the airport?”
- “Does this road intersect the river?”
- “Is this house inside the flood zone?”
- “Which cities are adjacent to Delhi?”
Spatial databases support spatial relationships through spatial data types and spatial operators.
⭐ TYPES OF SPATIAL RELATIONSHIPS
There are three main types of spatial relationships:
- Topological Relationships
- Directional Relationships
- Distance Relationships
Let’s discuss each in detail.
⭐ 1. Topological Relationships
(VERY important — based on the DE-9IM model)
Topological relationships describe how spatial objects touch, overlap, or contain each other, independent of distance or orientation.
These relationships are invariant under transformations like stretching, rotation, scaling (i.e., shape remains same).
Topological relationships include:
⭐ A. Touches
Two objects share a boundary point.
Example:
- Two adjacent buildings
- Two countries sharing a border
SQL:ST_Touches(A, B)
⭐ B. Intersects
Objects share some space in common.
Example:
- Road crossing a river
- Park overlapping a city boundary
SQL:ST_Intersects(A, B)
⭐ C. Contains
Object A fully contains object B.
Examples:
- Country contains a city
- Lake contains an island
SQL:ST_Contains(A, B)
⭐ D. Within
Reverse of contains.
Example:
- A house is within a residential zone
SQL:ST_Within(A, B)
⭐ E. Overlaps
Objects share some interior space but not fully.
Example:
- Two forest regions overlapping
- Flood zone overlapping farmland
SQL:ST_Overlaps(A, B)
⭐ F. Disjoint
Objects share no points in common.
Example:
- Two cities with no common boundary
SQL:ST_Disjoint(A, B)
⭐ G. Equals
Both shapes cover the exact same area.
SQL:ST_Equals(A, B)
✔ Summary Table (Topological)
| Relationship | Meaning |
|---|---|
| Intersects | Touching or crossing |
| Touches | Share boundary |
| Contains | A contains B |
| Within | A inside B |
| Overlaps | Partial overlap |
| Disjoint | No contact |
| Equals | Identical shape |
⭐ 2. Directional Relationships
Describe the relative direction of one object from another:
Examples:
✔ North / South
✔ East / West
✔ Northeast / Southwest
Used in:
- Navigation systems
- GIS analysis
- Mapping applications
Example query:
“Find cities west of the river.”
Spatial DBs use bounding boxes or vector math to determine direction.
⭐ 3. Distance Relationships
These relationships describe how far apart spatial objects are.
Examples:
✔ Near
✔ Far
✔ Within a radius
✔ Nearest neighbor
✔ Buffer zones
Important functions:
ST_Distance(A, B)ST_DWithin(A, B, radius)ST_Buffer(A, distance)
Use cases:
- Find hotels within 3 km of airport
- Find nearest ambulance to accident site
- Create 100 m safety buffer around a gas pipeline
⭐ COMBINED SPATIAL RELATIONSHIPS
Sometimes spatial relationships involve combined properties:
✔ Proximity + Direction
- “Hospitals north of the highway”
✔ Topology + Scale
- “Cities overlapping the flood-prone zone”
✔ Network relationships
Used in road networks:
- Connectivity
- Shortest path
- Reachability
⭐ SPATIAL RELATIONSHIP MODELS
Spatial databases formally define relationships using:
⭐ A. DE-9IM (Dimensionally Extended 9 Intersection Model)
Defines 9 intersections between object interiors and boundaries.
Used to evaluate:
✔ intersects
✔ overlaps
✔ touches
✔ disjoint
⭐ B. RCC (Region Connection Calculus)
Used for reasoning about regions geometrically.
Relationships:
✔ part-of
✔ connected
✔ overlapping
⭐ APPLICATIONS OF SPATIAL RELATIONSHIPS
✔ GIS Mapping
Identifying relationships between geographical entities.
✔ Navigation
Routing based on nearest roads, intersections.
✔ Urban Planning
Determining land parcels within zoning boundaries.
✔ Disaster Management
Finding buildings inside flood or earthquake zones.
✔ Telecom Network Planning
Phone towers within coverage radius.
✔ Real Estate
Properties near schools or amenities.
✔ Agriculture
Areas within irrigation network.
⭐ ADVANTAGES OF SPATIAL RELATIONSHIPS
✔ Allow complex geographical analysis
✔ Support spatial reasoning
✔ Enable efficient map-based queries
✔ Useful for spatial decision-making
✔ Improves spatial data organization
⭐ DISADVANTAGES
✘ Computationally expensive
✘ Requires spatial indexing
✘ Needs specialized spatial DBMS
✘ Complex algorithms for topological reasoning
⭐ Example SQL Queries (Simple)
✔ Find cities within 10 km of a river:
SELECT c.name
FROM cities c
JOIN rivers r
ON ST_DWithin(c.geom, r.geom, 10000);
✔ Find states that touch the coastline:
SELECT s.name
FROM states s
WHERE ST_Touches(s.geom, coastline.geom);
⭐ Perfect 5–6 Mark Short Answer
Spatial relationships describe how two spatial objects relate to each other in terms of topology, direction, and distance. Topological relationships include intersects, touches, overlaps, contains, within, and disjoint; directional relationships describe relative positions such as north or west; and distance relationships describe proximity such as near or within a radius. Spatial databases support these relationships through functions like ST_Intersects() and ST_Distance(), enabling applications in GIS, navigation, urban planning, disaster management, and location-based analytics.
