100% found this document useful (1 vote)
394 views22 pages

Quadtree Structures: Raster & Vector

Quadtrees are a data structure that divides space into four quadrants and are used for both raster and vector data. Raster quadtrees efficiently store large 2D arrays and allow for simple map overlays and queries. Vector quadtrees provide efficient access to vector data but have no performance guarantees due to dependencies on data distribution.

Uploaded by

api-3759413
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
394 views22 pages

Quadtree Structures: Raster & Vector

Quadtrees are a data structure that divides space into four quadrants and are used for both raster and vector data. Raster quadtrees efficiently store large 2D arrays and allow for simple map overlays and queries. Vector quadtrees provide efficient access to vector data but have no performance guarantees due to dependencies on data distribution.

Uploaded by

api-3759413
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

Quadtrees

Raster and vector


Quadtrees

• Finkel and Bentley, 1974


• Raster structure: divides space, not objects
• Form of block coding: compact storage of a
large 2-dimensional array
• Vector versions exist too
Quadtrees, the idea
NW NE

SW SE

NW NE SW SE
1, 4, 16, 64, 256
nodes
Quadtrees, the idea
NW NE

Choropleth raster map

SW SE

NW NE SW SE
Quadtrees

• Grid with 2k times 2k pixels


• Depth is k +1
• Internal nodes always have 4 children
• Internal nodes represent a non-homogeneous
region
• Leaves represent a homogeneous region and
store the common value (or name)
Quadtree complexity theorem

• A subdivision with boundary length r pixels


in a grid of 2k times 2k gives a quadtree with
O(k ⋅ r) nodes.
• Idea: two adjacent, different pixels “cost” at
most 2 paths in the quadtree.
Overlay with quadtrees

Water Acid rain with


PH below 4.5
Overlay with quadtrees
Result of overlay
Overlay algorithm, I

• If color Q1 is specified, and Q2 is a leaf,


then return a leaf for Q3 with as color the
combination of those of Q1 and Q2
• If color Q2 is specified, and Q1 is a leaf,
then return a leaf for Q3 with as color the
combination of those of Q1 and Q2
• If Q1 and Q2 are both a leaf,
then return a leaf for Q3 with as color the
combination of those of Q1 and Q2
Overlay algorithm, II
• If color Q1 is specified or Q1 is a leaf, and Q2
is an internal node,
then go into recursion on the four subtrees of
Q2 (with the color of Q1 as specified)
• If color Q2 is specified or Q2 is a leaf, and Q1
is an internal node,
then go into recursion on the four subtrees of
Q1 (with the color of Q2 as specified)
• If Q1 and Q2 are both internal nodes,
then go into recursion on the four
corresponding subtrees of Q1 and Q2
Overlay, efficiency

• Result is quadtree Q3 that represents


overlay
• Assume n nodes in Q1, m nodes in Q2:
O(n+m) time
• If Q3 need only contain the overlay
where Q1 has a particular theme, then
it can be done more efficiently by
pruning
Quadtree construction from
raster, I
• Construct complete quadtree on all
pixels
• Merge bottom-up groups of 4 with same
attribute

• Disadvantage: Temporarily a lot of


storage needed (quadtree on all pixels),
and not efficient in time
Quadtree construction from
raster, II
• Construct quadtree top-down and
recursively
• Merge immediately (before returning
from recursion) 4 subtrees if they are
4 leaves with the same attribute
Various queries

• Point location: trivial


• Windowing: descend into subtree(s) that
intersect query window
• Traversal boundary polygon: up and
down in the quadtree
Vector quadtree
• PM quadtree in naming of Samet
• Divide each square if there are:
- 2 or more vertices inside
- a vertex and an edge inside that are not
incident
- 2 (or more) edges inside, unless these edges
are all incident to the same vertex and this
vertex is also in the square
Leaf in vector quadtree

• Empty (inside a region; pointer to cell)


• One edge (pointer to edge in leaf)
• One vertex with incident edges (pointer to
vertex in leaf)
Example vector quadtree
Point location in vector
quadtree
• Go down quadtree to leaf that contains
the query point
• At the leaf, resolve the query

e
f v

O(1) time O(1) time O(degree(v)) time


Complexity vector quadtree
• Cannot be expressed in number of stored
objects only
• Depends on inter-distance of vertices
compared to region size
• Depends on “accidental” distance vertex to
side of a square
Alleviating the problem

• Allow a small number (e.g. 3 or 4) of points or


independent edges in a square
• Do not split squares beyond a certain size
Summary

• Raster quadtree: simple structure,


simple map overlay, simple queries

• Vector quadtree: possibly useful for


efficient access, no performance
guarantees

You might also like