← Back to Index
Chapter 3

Spatial Data Models

Syllabus & Marks Distribution

DetailInformation
Chapter3 — Spatial Data Models
Teaching Hours3 hours
Marks Allocation6 marks
Total Course Marks80 marks
Weight7.5% of total

Syllabus Topics

  • Concept of data model
  • Raster data model
  • Compression
  • Indexing and hierarchical data structures
  • Vector data model
  • Topology
  • TIN data model

Importance & Frequently Asked Topics HIGH

Marks Distribution by Each Exam

Asked 22 times across past exams. Total marks: 143. Average marks per exam: ~10.

ExamMarks
2071 Bhadra12
2071 Magh7
2072 Ashwin6
2072 Magh5
2073 Bhadra12
2073 Magh6
2074 Bhadra10
2074 Magh~5
2075 Bhadra12
2075 Magh4
2076 Bhadra9
2078 Chaitra12
2079 Chaitra16
2080 Chaitra17
2081 Chaitra10
2082 Shrawan—

Frequently Asked Topics

TopicTimes AskedFrequency
Compression 10
Concept of Data Model 8
Raster Data Model 5
Topology 3
Vector Data Model 2
TIN Data Model 2

Topic-wise Importance & Exam Tips

TopicImportanceKey Points / Exam Tips
Raster vs Vector data model comparisonHighVery frequently asked. Use comparison table covering structure, accuracy, storage, analysis, and best-use cases.
Topology in vector data modelHighDefine topology, explain three topological rules (connectivity, adjacency/contiguity, containment). Draw node-arc-polygon diagrams.
TIN data modelHighExplain Delaunay triangulation, advantages over raster DEM, and applications in terrain modeling.
Raster compression (Run-length encoding, Quadtree)MediumNumerical problems may be asked. Know how to compress a grid and calculate percentage decrease in storage.
Concept of data modelMediumDefine what a spatial data model is and why it's needed to represent real-world features digitally.
Indexing and hierarchical data structuresLowBrief explanation of quadtree indexing for spatial search optimization.

Key Concepts (Textbook pp.67–86)

  • Geographic Phenomenon: “A manifestation of an entity or process of interest that can be named or described, can be georeferenced, and can be assigned a time interval at which it is/was present.” (Textbook p.67)
  • Geographic Field: A phenomenon for which, at every point in the study area, a value can be determined: f(x,y) → value. Examples: elevation, temperature, rainfall. (Textbook p.69)
  • Geographic Object: Well-distinguished, discrete, bounded entities that populate the study area. The space between objects is potentially “empty.” Examples: buildings, roads, lakes. (Textbook p.70)
  • Rule of Thumb: Natural phenomena are usually modelled as fields (e.g., elevation surface). Man-made features are usually modelled as objects (e.g., buildings, roads). (Textbook p.70)
  • Tobler’s First Law of Geography: “Locations that are closer together are more likely to have similar values than locations that are far apart.” This principle of spatial autocorrelation underpins interpolation and geostatistics. (Textbook p.83)
  • Continuous vs. Discrete Fields: Continuous fields change gradually (elevation, temperature). Discrete fields divide space into bounded parts, each with a single value (land use, soil type). (Textbook pp.72–73)
  • Crisp vs. Fuzzy Boundaries: Crisp boundaries can be determined with arbitrary precision (man-made: political borders, property lines). Fuzzy boundaries are transition zones (natural: soil types, vegetation gradients). (Textbook p.81)

1. Types of Spatial Data Models in GIS

PAST EXAM QUESTIONS ON THIS TOPIC:

  1. Explain different types of data models [4] (2073 Bhadra, Q3a)
  2. Explain different types of data models [3] (2076 Bhadra, Q3a)
  3. Explain different types of data models in GIS [6] (2078 Chaitra, Q1)

A data model in GIS is a mathematical and conceptual framework used to represent real-world geographic features in a digital format. The primary spatial data models used to abstract and manage this information include:

Vector Points (x,y) Lines vertices Polygons B A Precise boundaries Small file size Network analysis Raster 50 45 38 30 22 15 48 40 32 25 18 10 42 35 28 20 12 5 High Low ← Elevation → Each cell = one value (pixel with attribute) Continuous surfaces Satellite imagery Simple overlay ops TIN 320m 490m 260m Delaunay Triangulation Variable resolution Terrain modeling Slope & aspect analysis
Fig 3.1 – The Three Primary Spatial Data Models in GIS: Vector (geometry-based), Raster (grid-based), and TIN (irregular triangles)

2. The Network Data Model

PAST EXAM QUESTIONS ON THIS TOPIC:

  1. What is the Network data model? Describe with examples [6] (2075 Bhadra, Q5)

The Network Data Model is a specialized, topologically structured vector model designed to represent interconnected linear features. It defines how lines connect to each other at nodes (intersections) to model the flow of resources or movement.

Network Data Model – Road Network Example 3.2 km 4.5 km 2.8 km 2.1 km 5.0 km 3.6 km 3.0 km A B C D E F = Node (junction) = Edge (road segment) Edge weight = distance/cost D = Destination
Fig 3.2 – Network Data Model: Nodes (junctions) connected by edges (road segments) with distance weights for shortest-path analysis

3. Attribute Variables: Qualitative vs. Quantitative

PAST EXAM QUESTIONS ON THIS TOPIC:

  1. Write short notes on: Different types of attribute variable used in GIS [2] (2074 Bhadra, Q6iii)
  2. Differentiate between qualitative and quantitative attributes in a vector dataset [4] (2080 Chaitra, Q8a)

Attribute data provides the descriptive, non-spatial information linked to spatial geometries. These variables are broadly categorized into two types:

AspectQualitative AttributesQuantitative Attributes
DefinitionCategorical/descriptive properties without numerical value or rankMeasurable numerical quantities that define magnitude
NatureDescribes "what kind" or "which category"Describes "how much" or "how many"
Sub-typesNominal (names, categories) and Ordinal (ranked categories)Discrete (counts) and Continuous (measurements)
ExamplesCity name, soil type (sandy, clay), zoning categoriesPopulation (50,000), road length (2.5 km), temperature (25°C)
Mathematical operationsCannot calculate mean or sum (only mode, frequency)Can calculate mean, sum, standard deviation, etc.
Symbology in GISUnique values / categorized symbols (different colors per category)Graduated colors or proportional symbols
Classification methodUnique valuesEqual interval, quantile, natural breaks, standard deviation

4. Levels of Measurement and their Impact on Symbology

PAST EXAM QUESTIONS ON THIS TOPIC:

  1. What are the levels of measurement of attribute data? How do they affect the symbology? [6] (2079 Chaitra, Q3a)
  2. Explain four levels (nominal, ordinal, interval, ratio) of commonly recognized data measurement (2081 Chaitra)

The scale of measurement of attribute data dictates the analytical operations possible and directly determines the symbology used to visually communicate the map's message.

Nominal Categories, no order Forest Water Urban Unique Values = / ≠ only e.g., Land use types, soil classifications Ordinal Ranked categories Low Med High Order matters Graduated Colors < > = (rank) e.g., Risk zones, satisfaction ratings Interval Equal spacing, no true 0 -20° 0° +40° Diverging Ramp + − × (equal gaps) e.g., Temperature °C, calendar year Ratio True zero, proportional 5k 25k 100k (population) 0 ∞ Proportional Symbols + − × ÷ (all ops) e.g., Population, area, distance, income Increasing measurement complexity and analytical power →
Fig 3.3 – Four Levels of Measurement: Nominal, Ordinal, Interval, and Ratio with their corresponding symbology methods

1. Vector vs. Raster Data Models

PAST EXAM QUESTIONS ON THIS TOPIC:

  1. Explain Vector model and Raster GIS Model with suitable examples [Part of 10] (2074 Magh, Q1)
  2. Discuss the key differences between vector and raster data models, highlighting strengths and weaknesses. Include a sketch [3+4] (2080 Chaitra, Q1)
  3. What are the basic elements of raster data model? Explain advantage and disadvantage of raster vs vector [3+] (2072 Magh, Q3)

Geographic Information Systems (GIS) use two main ways to represent the real world: Vector and Raster.

Feature Vector Data Model Raster Data Model
Basic Concept Uses geometry (points, lines, polygons) to represent exact real-world shapes. Uses a grid of square cells (pixels) to cover an area, where each cell has a value.
Best Used For Discrete data with clear boundaries (e.g., a specific building, a road, a property line). Continuous data that changes smoothly over space (e.g., elevation, temperature, rainfall).
Visualizing a Scene A tree is a single point, a road is a smooth line, and a building is an exact enclosed shape (polygon). The entire area is a grid. A building is a group of cells colored "building," and a road is a jagged line of "road" cells.
Advantages Very accurate boundaries; smaller file sizes; excellent for network analysis (like finding the shortest driving route). Simple structure; great for overlaying maps; handles continuous surfaces and satellite imagery perfectly.
Disadvantages Complex data structure; bad for continuous gradients like elevation; overlaying maps requires heavy computing. Can look pixelated/blocky; large file sizes; terrible for precise network routing.

Important Distinctions (Textbook pp.86–94)

  • Grid vs. Raster: These terms are not synonymous. A grid stores values at the intersections of regularly spaced lines. A raster stores values for the entire cell area (cell values, not point values). The value for a raster cell is assumed valid for all locations within that cell. (Textbook p.86)
  • Resolution: The cell size determines the level of detail. Smaller cells → better quality but larger file size. Cell size should match the accuracy of the original data source. (Lectures p.13)
  • Raster Algebra: Because raster cells can be handled as 2D arrays, many analytical operations (overlay, neighbourhood) are easy to program. This makes raster structures popular for mathematical modelling. (Lectures p.13)

2. Types of Raster Models

PAST EXAM QUESTIONS ON THIS TOPIC:

  1. Explain different types of Raster Models [6] (2071 Bhadra, Q3a)

Raster models are grouped into three basic types based on what their grid cells represent:

Continuous Values change gradually Elevation, temperature, rainfall surfaces Discrete Forest Water Urban Agriculture Forest Cells = categories Land use, soil type, zoning classification Image R G B Pixel = reflectance value Satellite imagery, aerial photos, drone captures
Fig 3.4 – Three Types of Raster Models: Continuous (gradual change), Discrete (categories), and Image (reflectance/energy)

3. Raster Compression & Vectorization

PAST EXAM QUESTIONS ON THIS TOPIC:

  1. Explain the raster compression techniques with appropriate examples [4] (2079 Chaitra, Q3b/Q4b)
  2. Define the terms region quadtree and vectorization [1+1] (2071 Magh, Q2a)
  3. Explain run length and quadtree compression techniques for raster data. (2081 Chaitra)
  4. Explain run length and quadtree compression techniques for raster data. (2081 Chaitra)

Raster files (grids) can get huge. We use compression techniques to make the files smaller without losing information.

4. Raster Data Storage Formats (BSQ, BIL, BIP)

PAST EXAM QUESTIONS ON THIS TOPIC:

  1. Illustrate BSQ, BIL, and BIP raster format (2075 Magh, Q5d)

When working with satellite images that have multiple layers (like a Red band, a Green band, and a Blue band), the computer needs a rule for how to store that data line-by-line.

BSQ Band Sequential Band 1 – Row 1 Band 1 – Row 2 Band 1 – Row 3 Band 2 – Row 1 Band 2 – Row 2 ⋮ Band 3 … All of Band 1, then all of Band 2… Best for single-band access BIL Band Interleaved by Line Row 1 – Band 1 (R) Row 1 – Band 2 (G) Row 1 – Band 3 (B) Row 2 – Band 1 (R) Row 2 – Band 2 (G) Row 2 – Band 3 (B) ⋮ Row 1 all bands, then Row 2 all bands… Good balance of both BIP Band Interleaved by Pixel P1-R P1-G P1-B P2-R P2-G P2-B P3-R P3-G P3-B P4-R P4-G P4-B ↑ One pixel = all bands together ⋮ Pixel 1 all bands, Pixel 2 all bands… Best for per-pixel spectral analysis
Fig 3.5 – Raster Storage Formats: BSQ (band-first), BIL (line-interleaved), and BIP (pixel-interleaved) for multi-band satellite imagery

3.4 Indexing and Hierarchical Data Structures

No direct past exam questions have been asked from this section, but it is part of the syllabus and may appear in future exams.

When a GIS database contains millions of spatial features (e.g., every building in Kathmandu Valley), finding which features fall within a query area requires an efficient search strategy. Spatial indexing organizes features so the system doesn't have to check every single feature — it can quickly narrow down candidates.

Why Spatial Indexing is Needed

Without indexing, a spatial query like "Find all buildings within 1 km of this road" would require checking every building in the entire database — a brute-force approach that becomes impossibly slow with large datasets. Spatial indexes partition space into manageable regions so only relevant features are examined.

Common Spatial Indexing Methods

  1. Grid Index: The study area is divided into a regular grid of equal-sized cells. Each feature is assigned to the cell(s) it overlaps. During a query, only features in the relevant cells are checked.
    • Advantage: Simple to implement
    • Disadvantage: Inefficient when features are unevenly distributed (many empty cells, some overloaded cells)
  2. Quadtree: A hierarchical structure that recursively subdivides space into four quadrants. Areas with more features are subdivided further, while empty areas remain as large, undivided blocks. (This is related to the quadtree compression technique covered in Section 3.3.)
    • Advantage: Adapts to data density — more detail where needed
    • Disadvantage: More complex to build and maintain
  3. R-Tree (Rectangle Tree): Groups nearby spatial objects into minimum bounding rectangles (MBRs) and organizes them in a balanced tree structure. When searching, the algorithm first checks which bounding rectangles intersect the query window, then examines the actual features only within matching rectangles.
    • Advantage: Very efficient for both point and polygon data; used in most modern GIS (PostGIS, ArcGIS)
    • Disadvantage: MBRs can overlap, causing some redundant checks

Hierarchical Data Structures

In the context of GIS, hierarchical structures organize spatial data in a tree-like fashion where:

Examples include the quadtree (divides into 4), octree (divides into 8, used for 3D data), and k-d trees (binary space partitioning). These structures enable fast spatial searches with time complexity of O(log n) instead of O(n).

1. Concept and Importance of Topology

PAST EXAM QUESTIONS ON THIS TOPIC:

  1. Write short notes on: Topology [3] (2071 Magh, Q6b)
  2. Why is topology important in GIS? (2075 Bhadra, Q3b)

What is Topology? Topology is a set of rules and mathematical concepts that define the spatial relationships between adjacent or connected geographic features (points, lines, and polygons) in a vector data model. It dictates how features share geometry.

Connectivity N Arc 1 Arc 2 Arc 3 Lines share nodes Arcs meet at junction N → enables routing analysis Adjacency A B Shared boundary Polygons A & B share a common edge (red line) Containment Region Zone P ⊃ Feature within feature Point P is inside Zone, Zone is inside Region
Fig 3.6 – Three Key Topological Relationships: Connectivity (shared nodes), Adjacency (shared edges), and Containment (within boundaries)

Why is it important in GIS?

2. The TIN (Triangulated Irregular Network) Data Model

PAST EXAM QUESTIONS ON THIS TOPIC:

  1. Explain TIN Data model [4] (2072 Ashwin, Q1c)
  2. Does TIN belong to a raster or a vector and why? [4] (2071 Magh, Q2a)

What is a TIN? A TIN is a digital data structure used to represent continuous 3D surfaces most commonly terrain or elevation. It constructs this surface using a network of non-overlapping contiguous triangles. The corners of these triangles are created from irregularly spaced data points (called mass points) where each point contains an X Y and Z (elevation) coordinate.

Does TIN belong to Raster or Vector?

A TIN strictly belongs to the vector data model.

Why? Unlike a raster model which relies on a uniform grid of identical square cells (pixels) to represent a surface a TIN is built entirely from fundamental vector geometries. It uses points (the nodes with XYZ coordinates) connected by lines (the edges) to form polygons (the triangular faces). Because it does not use a continuous pixel grid it is classified as a vector surface model.

TIN Surface Model – 3D Terrain Representation 520m 480m Node (x y z) → Irregular sample points with elevation Triangles → More triangles where terrain is complex (peaks valleys) Higher density = higher accuracy Slope aspect visibility analysis
Fig 3.7 – TIN 3D Terrain Surface: irregular triangles model elevation with denser triangulation in complex terrain areas

Delaunay Triangulation (Textbook p.94)

Delaunay triangulation is a method of constructing triangles from a set of sample points such that the triangles are as equilateral as possible. The key property: the circumscribed circle (circumcircle) of each triangle contains no other anchor/sample point inside it. This maximizes the minimum angle of all triangles, avoiding long, thin “sliver” triangles that produce poor interpolation results.

Thiessen/Voronoi Polygons: The dual of a Delaunay triangulation. Each Voronoi polygon contains all locations closer to a particular sample point than to any other sample point. Together, Delaunay triangulation and Voronoi polygons provide complementary views of spatial proximity.

3. Topology within the TIN Data Model

PAST EXAM QUESTIONS ON THIS TOPIC:

  1. What is topology in TIN data model? [2] (2073 Bhadra, Q3b)

What is topology in a TIN?

In a TIN model topology refers to the explicit mathematical relationships maintained between its components: the nodes edges and triangular faces.

Numerical Procedures

Lossless vs. Lossy Compression (Lectures p.14, 16)

  • Lossless compression: Original data can be precisely reconstructed. Run-length encoding (RLE) and block encoding are lossless. Suitable for DEMs and classified rasters where exact values matter.
  • Lossy compression: Data cannot be fully reconstructed but achieves much higher compression ratios. MrSID (wavelet-based) can compress aerial photographs dramatically but is not suitable for DEMs or analytical rasters.
  • JPEG 2000: Uses wavelet compression similar to MrSID, increasingly used for image compression in geospatial applications.
  • File size examples: A 30 m DEM ≈ 1.1 MB; a 10 m DEM ≈ 9.9 MB. High-resolution rasters require compression for practical storage and web delivery. (Lectures p.14)

1. Run Length Encoding (RLE)

(Applies to questions asking for Run Length Encoding)

This method compresses data by grouping identical adjacent cell values in a single row.

Original Grid 1 1 1 2 1 2 2 2 R1→ R2→ RLE compress RLE Encoded Row 1: (3 1) (1 2) Row 2: (1 1) (3 2) 8 → 4 pairs 50% saved Identical consecutive values are grouped as (count value) pairs per row
Fig 3.8 – Run Length Encoding (RLE) Compression Example
  1. Read Row by Row: Start at the top-left cell of the raster grid and read across the first row.
  2. Count Consecutive Values: Count how many times a specific value repeats sequentially.
  3. Write the Pair: Write down the count followed by the value. (For example if you see five cells with the number "27" write it as (5 27) or 5:27).
  4. Reset at Changes or New Rows: When the number changes start a new count. When you reach the end of a row always start a fresh count for the next row (standard row-by-row RLE).
  5. Final Output: Your answer should be a linear list of these pairs for the entire grid.

2. Quadtree Encoding

(Applies to questions asking for Quad tree encoding)

This is a spatial compression method that divides grids into four quadrants (NW NE SW SE).

4×4 Grid 1 1 1 1 1 1 2 2 1 1 1 2 1 1 1 1 NW NE/SE mixed → decompose Quadtree Structure Root NW=1 NE SW=1 SE 1 2 1 2 1 1 1 2 ● Uniform → leaf | ● Mixed → subdivide further
Fig 3.9 – Quadtree Encoding: Grid division into quadrants with tree structure
  1. Check the Whole Grid: Look at the entire grid (e.g. 8x8). Does every single cell have the exact same value?
    • If yes: The entire grid is just one value. Stop.
    • If no: Proceed to Step 2.
  2. Divide into Four: Split the grid evenly into four quadrants.
  3. Evaluate Each Quadrant: Look at the top-left quadrant (NW) first.
    • Are all cells inside it identical? If yes record that value.
    • If there are mixed values split that specific quadrant into four smaller quadrants.
  4. Repeat (Recurse): Continue this process of evaluating and splitting for the NE SW and SE quadrants. Keep splitting mixed blocks until every block you have contains only a single uniform value.
  5. Final Output: Draw a tree diagram. The top root is the whole grid branching into 4 nodes. Uniform nodes stop (leaf nodes). Mixed nodes branch into 4 more nodes.

3. Block Encoding

(Applies to questions asking for Block encoding)

Instead of grouping rows or dividing by strict quadrants this method looks for the largest possible square blocks of identical values anywhere in the grid.

  1. Find the Largest Squares: Scan the grid for the biggest possible square (e.g. 4x4) where all cells are the exact same value.
  2. Record the Block: Write down three things for that block:
    • Its starting coordinate (usually the row and column of its top-left or bottom-left corner).
    • The size of the square (e.g. 4).
    • The value of the cells inside it.
  3. Move to Smaller Squares: Once you've mapped out the largest squares find the next largest (e.g. 2x2 squares) and record them.
  4. Record Single Cells: Finally any leftover cells that don't form a 2x2 or larger square must be recorded as 1x1 blocks.
  5. Final Output: A list of coordinates sizes and values.

4. Chain Encoding

(Applies to questions asking for Chain encoding)

This method is used to trace the boundary of a specific feature (like a polygon of "forest" cells). It relies on a directional grid (usually 0 to 7 where 0 is East 1 is North-East 2 is North etc.).

Direction Codes (0–7) 0 East 1 2 3 4 5 6 7 Chain Code Tracing Example S Output: Start: (2 1) Code: 0 0 6 5 4 2 2 (trace returns to start) Compact boundary encoding Trace the boundary clockwise recording each movement direction (0–7) until you return to start
Fig 3.10 – Chain Encoding: 8-direction compass codes (left) and boundary tracing example (right)
  1. Pick a Start Node: Choose an outer boundary pixel of the shape you are tracing. Record its (X Y) coordinate as the starting point.
  2. Trace the Boundary: Move to the next adjacent pixel along the boundary of the shape.
  3. Record the Direction: Write down the directional code (0-7) that corresponds to the direction you just moved.
  4. Loop Back: Continue moving along the edge recording the direction code for every step until you arrive back at your starting pixel.
  5. Final Output: The starting coordinate followed by a sequence of directional numbers.

5. Value Point Encoding

(Applies to questions asking for Value point encoding)

This is basically an index of coordinates for every value.

  1. List Unique Values: Look at the grid and write down every unique value that appears (e.g. Forest Water Settlement).
  2. Find Coordinates: Establish a coordinate system (e.g. top-left cell is 0 0 or 1 1).
  3. Group by Value: For each unique value simply write a list of the (X Y) coordinates of every single cell that contains that value.
  4. Final Output: A grouped list: Value A: (1 1) (1 2) (2 1)...

6. Calculating Percentage Decrease in Size

(Applies to questions asking for % decrease in size)

This proves how effective your compression was.

  1. Calculate Uncompressed Size: Count the total number of cells in the original grid (e.g. an 8x8 grid = 64 cells).
  2. Calculate Compressed Size: Count the number of data elements in your compressed version. (For RLE count the number of data pairs you created. For Quadtree count the total number of leaf nodes in your tree).
  3. Apply the Formula: Use the standard percentage decrease formula:
    Percentage Decrease = ((Uncompressed Size − Compressed Size) / Uncompressed Size) × 100%

Solved Numerical Examples (Past Exam Questions)

The following are fully worked solutions from past examination papers demonstrating the practical application of every raster encoding method. Study the step-by-step approach carefully — the same methodology applies to any grid you encounter in the exam.

Example 1

PAST EXAM QUESTIONS ON THIS TOPIC:

  1. Write down the three raster encoding methods and % decrease in size for the following figure [6] (2074 Bhadra, Q1b)
  2. How is the following raster encoded using full raster encoding, run length encoding, quad tree encoding, and value point encoding? [6] (2073 Magh, Q3)
Question: Given the following 8 × 8 raster grid (F = Forest, W = Water, O = Open Space, S = Settlement), encode it using: (a) Full Raster, (b) Run-Length Encoding, (c) Quadtree, and (d) Value Point Encoding.

Given Grid (8 × 8):

C1C2C3C4C5C6C7C8
R1FFFFWWFF
R2FFFFWWFF
R3FFFFOOFF
R4FFFFOOFF
R5FFFFSSSS
R6FFFFSSSS
R7FFFFSSWW
R8FFFFSSWW

Original (uncompressed) size = 8 × 8 = 64 cells.

Solution (a) — Full Raster:

Simply list every cell value row by row. Total stored values = 64 (no compression).

F F F F W W F F  |  F F F F W W F F  |  F F F F O O F F  |  F F F F O O F F  |  F F F F S S S S  |  F F F F S S S S  |  F F F F S S W W  |  F F F F S S W W

Solution (b) — Run-Length Encoding (RLE):

RowRLE PairsPairs
R1(F, 4), (W, 2), (F, 2)3
R2(F, 4), (W, 2), (F, 2)3
R3(F, 4), (O, 2), (F, 2)3
R4(F, 4), (O, 2), (F, 2)3
R5(F, 4), (S, 4)2
R6(F, 4), (S, 4)2
R7(F, 4), (S, 2), (W, 2)3
R8(F, 4), (S, 2), (W, 2)3

Total RLE pairs = 3 + 3 + 3 + 3 + 2 + 2 + 3 + 3 = 22

% Decrease = ((64 − 22) / 64) × 100 = (42 / 64) × 100 = 65.63 %

Solution (c) — Quadtree Encoding:

Recursively divide the 8 × 8 grid into four equal quadrants. If a quadrant is homogeneous (all cells same value), it becomes a leaf node. Otherwise, subdivide again.

Total leaf nodes = 10 (F, W, F, O, F, F, S, S, S, W)

% Decrease = ((64 − 10) / 64) × 100 = (54 / 64) × 100 = 84.38 %

Solution (d) — Value Point Encoding:

List every unique value and the (Row, Col) coordinates of each cell containing that value:

ValueCoordinatesCount
F(1,1)–(1,4), (1,7)–(1,8), (2,1)–(2,4), (2,7)–(2,8), (3,1)–(3,4), (3,7)–(3,8), (4,1)–(4,4), (4,7)–(4,8), (5,1)–(5,4), (6,1)–(6,4), (7,1)–(7,4), (8,1)–(8,4)40
W(1,5), (1,6), (2,5), (2,6), (7,7), (7,8), (8,7), (8,8)8
O(3,5), (3,6), (4,5), (4,6)4
S(5,5)–(5,8), (6,5)–(6,8), (7,5), (7,6), (8,5), (8,6)12

Unique values = 4. All 64 cell positions are recorded, grouped under their respective values.

Example 3

PAST EXAM QUESTIONS ON THIS TOPIC:

  1. Compress the given raster data using the quadtree method [4] (2075 Bhadra, Q3a)
Question: Construct a Quadtree for the following 8 × 8 raster grid.

Given Grid (8 × 8):

C1C2C3C4C5C6C7C8
R11212121210101010
R21212121210101010
R31212121210101010
R41212121210101010
R599726644
R699136644
R733882255
R833882255

Original size = 8 × 8 = 64 cells.

Quadtree Decomposition:

Total leaf nodes = 13: (12, 10, 9, 7, 2, 1, 3, 3, 8, 6, 4, 2, 5)

% Decrease = ((64 − 13) / 64) × 100 = (51 / 64) × 100 = 79.69 %

Example 4

PAST EXAM QUESTIONS ON THIS TOPIC:

  1. Explain run length encoding. Also produce: (a) Quad tree (b) Block encoding (c) Chain encoding [4+2+2+2] (2080 Chaitra, Q7)
Question: Encode the following 8 × 8 raster grid using (a) Run-Length Encoding, (b) Quadtree, (c) Block Encoding, and (d) Chain Encoding.

Given Grid (8 × 8):

C1C2C3C4C5C6C7C8
R125253131252533
R225253131252533
R325253131252533
R425253131252533
R52727272727272727
R62727272727272727
R72727272727273527
R82727272727272727

Original size = 8 × 8 = 64 cells.

Solution (a) — Run-Length Encoding (RLE) [4 marks]:

RowRLE PairsPairs
R1(25, 2), (31, 2), (25, 2), (3, 2)4
R2(25, 2), (31, 2), (25, 2), (3, 2)4
R3(25, 2), (31, 2), (25, 2), (3, 2)4
R4(25, 2), (31, 2), (25, 2), (3, 2)4
R5(27, 8)1
R6(27, 8)1
R7(27, 6), (35, 1), (27, 1)3
R8(27, 8)1

Total RLE pairs = 4 + 4 + 4 + 4 + 1 + 1 + 3 + 1 = 22

% Decrease = ((64 − 22) / 64) × 100 = (42 / 64) × 100 = 65.63 %

Solution (b) — Quadtree Encoding [2 marks]:

Total leaf nodes = 16

% Decrease = ((64 − 16) / 64) × 100 = (48 / 64) × 100 = 75.00 %

Solution (c) — Block Encoding [2 marks]:

Identify the largest homogeneous rectangular blocks:

BlockValueStartSizeCells
B125(R1, C1)4 × 28
B231(R1, C3)4 × 28
B325(R1, C5)4 × 28
B43(R1, C7)4 × 28
B527(R5, C1)4 × 624
B627(R5, C7)2 × 24
B735(R7, C7)1 × 11
B827(R7, C8)1 × 11
B927(R8, C7)1 × 22

Total blocks = 9

% Decrease = ((64 − 9) / 64) × 100 = (55 / 64) × 100 = 85.94 %

Solution (d) — Chain Encoding [2 marks]:

Chain encoding traces the boundary of each connected region using the 8-direction Freeman chain code:

2 = North (↑)    0 = East (→)    6 = South (↓)    4 = West (←)

Trace the boundary of each distinct region clockwise from its top-left cell:

Region (Value)Start CellFreeman Chain Code
25 (Patch 1: R1–4, C1–2)(1, 1)0, 6, 6, 6, 4, 2, 2, 2
31 (R1–4, C3–4)(1, 3)0, 6, 6, 6, 4, 2, 2, 2
25 (Patch 2: R1–4, C5–6)(1, 5)0, 6, 6, 6, 4, 2, 2, 2
3 (R1–4, C7–8)(1, 7)0, 6, 6, 6, 4, 2, 2, 2
27 (R5–8, C1–8, except (7,7))(5, 1)0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2
35 (single cell R7, C7)(7, 7)0, 6, 4, 2 (single-cell boundary)

Example 5

PAST EXAM QUESTIONS ON THIS TOPIC:

  1. How will the following land use raster be compressed using quadtree compression technique and run length coding technique? [6] (2076 Bhadra, Q3b)
Question: Construct a Quadtree and perform Run-Length Encoding for the following 8 × 8 grid.

Given Grid (8 × 8):

C1C2C3C4C5C6C7C8
R111113344
R211113344
R311113344
R411115554
R522225555
R622225555
R711113355
R811113355

Original size = 8 × 8 = 64 cells.

Solution (a) — Quadtree Encoding:

Total leaf nodes = 19

% Decrease = ((64 − 19) / 64) × 100 = (45 / 64) × 100 = 70.31 %

Solution (b) — Run-Length Encoding (RLE):

RowRLE PairsPairs
R1(1, 4), (3, 2), (4, 2)3
R2(1, 4), (3, 2), (4, 2)3
R3(1, 4), (3, 2), (4, 2)3
R4(1, 4), (5, 3), (4, 1)3
R5(2, 4), (5, 4)2
R6(2, 4), (5, 4)2
R7(1, 4), (3, 2), (5, 2)3
R8(1, 4), (3, 2), (5, 2)3

Total RLE pairs = 3 + 3 + 3 + 3 + 2 + 2 + 3 + 3 = 22

% Decrease = ((64 − 22) / 64) × 100 = (42 / 64) × 100 = 65.63 %

Example 6

PAST EXAM QUESTIONS ON THIS TOPIC:

  1. Show the encoding of the following raster using run length and Quadtree encoding [6] (2073 Bhadra, Q3c)
Question: Perform Run-Length Encoding and construct a Quadtree for the following 8 × 8 grid.

Given Grid (8 × 8):

C1C2C3C4C5C6C7C8
R11212121212121212
R21212121212121212
R31212121212121212
R41212121212121212
R555669999
R65561629699
R777779999
R877779999

Original size = 8 × 8 = 64 cells.

Solution (a) — Run-Length Encoding (RLE):

RowRLE PairsPairs
R1(12, 8)1
R2(12, 8)1
R3(12, 8)1
R4(12, 8)1
R5(5, 2), (6, 2), (9, 4)3
R6(5, 2), (61, 1), (62, 1), (9, 1), (6, 1), (9, 2)6
R7(7, 4), (9, 4)2
R8(7, 4), (9, 4)2

Total RLE pairs = 1 + 1 + 1 + 1 + 3 + 6 + 2 + 2 = 17

% Decrease = ((64 − 17) / 64) × 100 = (47 / 64) × 100 = 73.44 %

Solution (b) — Quadtree Encoding:

Total Quadtree leaf nodes = 2 (NW, NE) + 6 (SW children) + 7 (SE children) = 15 nodes (approx).

Quadtree stores 15 leaf values vs. 64 pixels → significant compression for regions with large uniform areas.

Interactive Raster Encoding Solver

Enter values into the 8×8 grid below (or load an exam preset) and instantly compute Run-Length Encoding (RLE), Quadtree Encoding, and percentage decrease. The solver shows every step of the encoding process.

🧩 Enter 8×8 Raster Grid

Run-Length Encoding
Quadtree Encoding
Summary & Comparison
  • SE (R5–8, C5–8): Mixed → Split
    • SE-NW (R5–6, C5–6): Mixed (9, 9, 9, 6) → Split
      • SE-NW-NW (R5, C5): 9 → Leaf: 9
      • SE-NW-NE (R5, C6): 9 → Leaf: 9
      • SE-NW-SW (R6, C5): 9 → Leaf: 9
      • SE-NW-SE (R6, C6): 6 → Leaf: 6
    • SE-NE (R5–6, C7–8): All 9 → Leaf: 9
    • SE-SW (R7–8, C5–6): All 9 → Leaf: 9
    • SE-SE (R7–8, C7–8): All 9 → Leaf: 9
  • Total leaf nodes = 16

    % Decrease = ((64 − 16) / 64) × 100 = (48 / 64) × 100 = 75.00 %

    Example 7

    PAST EXAM QUESTIONS ON THIS TOPIC:

    Past Exam Q7

    Question: Perform Run-Length Encoding and construct a Quadtree for the following 8 × 8 grid.

    Given Grid (8 × 8):

    C1C2C3C4C5C6C7C8
    R1888875349999
    R2888833759999
    R3888888349999
    R4777777779999
    R55656565656561010
    R65656565633251010
    R7565656563333339
    R85656565633333333

    Original size = 8 × 8 = 64 cells.

    Solution (a) — Run-Length Encoding (RLE):

    RowRLE PairsPairs
    R1(88, 2), (75, 1), (34, 1), (9, 4)4
    R2(88, 2), (33, 1), (75, 1), (9, 4)4
    R3(88, 3), (34, 1), (9, 4)3
    R4(77, 4), (9, 4)2
    R5(56, 6), (10, 2)2
    R6(56, 4), (33, 1), (25, 1), (10, 2)4
    R7(56, 4), (33, 3), (9, 1)3
    R8(56, 4), (33, 4)2

    Total RLE pairs = 4 + 4 + 3 + 2 + 2 + 4 + 3 + 2 = 24

    % Decrease = ((64 − 24) / 64) × 100 = (40 / 64) × 100 = 62.50 %

    Solution (b) — Quadtree Encoding:

    Total leaf nodes = 25

    % Decrease = ((64 − 25) / 64) × 100 = (39 / 64) × 100 = 60.94 %

    Chapter Summary

    This chapter explains the three fundamental spatial data models used in GIS. The Raster Data Model represents the world as a grid of cells (pixels), each holding a single value — ideal for continuous phenomena like elevation, temperature, and rainfall. Raster compression techniques (run-length encoding, quadtree) reduce storage requirements. The Vector Data Model represents features as points, lines, and polygons with precise coordinates — ideal for discrete features like roads, buildings, and boundaries. Topology (the mathematical rules governing spatial relationships like adjacency, connectivity, containment) is critical for vector data integrity. The TIN (Triangulated Irregular Network) Data Model uses irregularly-spaced sample points connected into non-overlapping triangles (Delaunay triangulation) for efficient terrain surface modeling. Indexing and hierarchical data structures (quadtrees, R-trees) for efficient spatial data retrieval are also covered.