The Central Idea

A geometric representation determines how spatial information is stored and what computations are natural.

Two major models are:

Neither representation is universally better. The appropriate choice depends on the problem.

Raster Representation

A raster divides a domain into regularly arranged cells.

In two dimensions, these cells are commonly pixels:

\[ \boxed{ \text{raster} = \text{regular grid of sampled cells} }. \]

Each cell stores a value such as color, elevation, temperature, category, density, or occupancy.

A Raster as an Array

A raster with \(m\) rows and \(n\) columns can be represented as a matrix

\[ R= \begin{bmatrix} r_{11} & r_{12} & \cdots & r_{1n}\\ r_{21} & r_{22} & \cdots & r_{2n}\\ \vdots & \vdots & \ddots & \vdots\\ r_{m1} & r_{m2} & \cdots & r_{mn} \end{bmatrix}. \]

The matrix structure makes neighborhood operations and image-style processing especially natural.

Pixels and Cells

In an image, a raster cell is usually called a pixel.

In geographic or scientific grids, the same idea may be called a cell.

The mathematical concept is the same: a finite region of space receives a stored sample or aggregate value.

Raster Resolution

Raster resolution describes the spatial size represented by one cell.

If a square domain of width \(W\) is divided into \(n\) cells across, then the cell width is

\[ \boxed{ \Delta x=\frac{W}{n} }. \]

Smaller cells produce finer spatial resolution.

Higher Resolution Means More Data

If both horizontal and vertical resolution are doubled, the number of cells increases by a factor of four.

For an \(n\times n\) raster:

\[ n^2 \]

cells become

\[ (2n)^2=4n^2. \]

Thus finer resolution comes with increased storage and processing cost.

Coordinate Location of a Raster Cell

Suppose the raster begins at

\[ (x_0,y_0) \]

and uses cell widths

\[ \Delta x,\qquad \Delta y. \]

A common center coordinate for column \(j\), row \(i\) is

\[ \boxed{ x_j=x_0+\left(j+\frac12\right)\Delta x } \]

and

\[ \boxed{ y_i=y_0+\left(i+\frac12\right)\Delta y }. \]

Raster Data Can Represent More than Images

Raster values may encode:

Vector Representation

Vector representation stores geometric objects using coordinates and mathematical structure.

Common vector primitives include:

A Vector Point

A point can be stored directly as coordinates:

\[ \boxed{ P=(x,y) }. \]

The location is represented independently of any pixel grid.

A Vector Segment

A segment can be stored by its endpoints:

\[ \boxed{ \overline{AB} } \]

where

\[ A=(x_1,y_1), \qquad B=(x_2,y_2). \]

Every intermediate point can be generated parametrically:

\[ P(t)=A+t(B-A), \qquad 0\le t\le1. \]

A Vector Polygon

A polygon can be represented by an ordered list of vertices:

\[ \boxed{ V_0,V_1,\ldots,V_{n-1} }. \]

Consecutive vertices define edges, and the final vertex connects back to the first.

The object is defined by geometric relationships rather than by filled grid cells.

Vector Curves

Vector geometry can represent curved shapes using mathematical curve models such as:

These curves can often be evaluated at arbitrary resolution.

Raster versus Vector: The Core Contrast

Raster representation asks:

\[ \boxed{ \text{What value belongs to this cell?} } \]

Vector representation asks:

\[ \boxed{ \text{What geometric object is here?} } \]

This difference shapes nearly every later computation.

Raster Is Sample-Based

A raster represents a continuous or geometric phenomenon through finite samples.

Details smaller than the cell scale may be lost, averaged, aliased, or represented inaccurately.

Vector Is Object-Based

Vector data explicitly represents objects and their boundaries.

A straight segment remains mathematically straight regardless of display zoom.

The displayed pixels may change, but the underlying geometry does not.

Scaling Raster Graphics

Enlarging a raster image spreads a fixed collection of samples over a larger display area.

The result may reveal individual pixels or require interpolation between them.

Raster scaling therefore cannot create geometric detail that was never sampled.

Scaling Vector Graphics

Vector geometry can generally be reevaluated at a new display scale.

A circle stored by center and radius remains a circle whether displayed at \(100\) pixels across or \(10{,}000\) pixels across.

The geometry is resolution independent until it is rasterized for display.

Rasterization

Rasterization converts vector geometry into raster cells or pixels.

Conceptually:

\[ \boxed{ \text{vector geometry} \longrightarrow \text{pixel coverage} }. \]

Computer graphics hardware performs rasterization constantly when drawing triangles, lines, and curves to a screen.

Vectorization

Vectorization attempts the reverse:

\[ \boxed{ \text{raster samples} \longrightarrow \text{geometric objects} }. \]

This is usually harder because the original geometry may have been blurred, sampled, quantized, or partially lost.

Rasterization Is Many-to-One

Different geometric shapes can sometimes produce the same finite pixel pattern at a given resolution.

Therefore, rasterization may discard information.

This is one reason exact reconstruction of vector geometry from raster data is generally impossible without additional assumptions.

Sampling

Sampling converts a continuous phenomenon into discrete measurements.

For a one-dimensional function \(f(x)\), samples might be taken at

\[ x_k=x_0+k\Delta x. \]

A two-dimensional raster applies the same basic principle across a grid.

Quantization

Sampling determines where values are recorded.

Quantization determines which finite values are available to store.

For example, an image channel may use integer values

\[ 0,1,\ldots,255. \]

Both spatial sampling and value quantization influence raster accuracy.

Aliasing

Aliasing occurs when sampling resolution is too coarse to capture the underlying variation faithfully.

In images, diagonal or curved boundaries may appear as stair steps.

In sampled fields, high-frequency structure may appear as false lower- frequency patterns.

Antialiasing

Antialiasing reduces visible sampling artifacts by estimating partial coverage or combining information from multiple samples.

For a boundary passing through a pixel, the stored color may reflect the fraction of the pixel covered by the shape rather than making a crude all-or-nothing choice.

Binary Rasterization

In a binary raster, each cell may store only

\[ 0 \quad\text{or}\quad 1. \]

For a region \(R\), one convention might use

\[ r_{ij}= \begin{cases} 1,&\text{if the cell center lies in }R,\\ 0,&\text{otherwise}. \end{cases} \]

Other coverage rules are also possible.

Cell-Center Rules versus Coverage Rules

Rasterizing a region requires a policy.

A cell may be marked occupied when:

Different policies create different raster boundaries.

Raster Boundary Error

A smooth or oblique vector boundary becomes a sequence of occupied grid cells when rasterized.

The resulting staircase boundary may differ from the original geometry by an amount related to the cell size.

Finer resolution reduces this geometric discretization error.

Raster Neighborhoods

Grid structure provides natural local neighborhoods.

In two dimensions, common choices include:

The neighborhood definition affects connectedness, pathfinding, region growth, and image-processing algorithms.

Four-Neighbor Connectivity

A cell has four orthogonal neighbors:

\[ (i-1,j),\quad (i+1,j),\quad (i,j-1),\quad (i,j+1). \]

Diagonal cells are not directly adjacent under this convention.

Eight-Neighbor Connectivity

Eight-neighbor connectivity adds the four diagonal cells.

This makes diagonal contact count as adjacency.

A raster algorithm must define which neighborhood model it uses.

Vector Topology

Vector data can store explicit topological relationships such as:

These relationships are not automatically implied by coordinate lists unless the data model records them.

Coordinate Equality Is Not Always Topological Equality

Two vector vertices may have identical or nearly identical coordinates but still be stored as separate records.

Conversely, one stored vertex may intentionally be shared by several edges.

Geometric position and data connectivity are related but distinct concepts.

Polylines

A polyline is an ordered sequence of vertices connected by line segments:

\[ P_0\to P_1\to\cdots\to P_n. \]

It is useful for representing:

Polygon Rings

Vector polygons are often represented by closed rings.

An outer ring defines the exterior boundary.

Additional inner rings can define holes.

Ring orientation may also carry meaning in some formats or algorithms.

Raster Storage Cost

A raster's storage is strongly tied to domain resolution.

If an \(m\times n\) raster stores \(b\) bytes per cell, its raw storage is

\[ \boxed{ mnb } \]

bytes, before compression or metadata.

Vector Storage Cost

Vector storage is tied more closely to geometric complexity.

A polygon with ten vertices can be represented with roughly ten coordinate pairs regardless of the display resolution.

A highly detailed coastline may require millions of vertices.

Which Representation Is More Compact?

There is no universal answer.

Vector representation can be very compact for simple shapes.

Raster representation can be efficient for dense continuous fields and can compress well when values contain regular patterns.

Continuous Fields Favor Raster Structures

Data such as temperature, elevation, concentration, and image intensity are naturally sampled over space.

Raster models provide a direct cell-by-cell structure for such quantities.

Discrete Objects Favor Vector Structures

Roads, parcels, boundaries, buildings, and routes are naturally represented as distinct geometric objects.

Vector models can preserve their coordinates and connectivity directly.

Raster Distance

Distance on a grid depends on the allowed movement model.

Four-neighbor movement corresponds naturally to a Manhattan-like path metric.

Eight-neighbor movement approximates Euclidean movement more closely when diagonal steps are given appropriate cost.

Vector Distance

Vector geometry can compute Euclidean distance directly from coordinates.

For points \(A\) and \(B\),

\[ \boxed{ d(A,B)= \sqrt{ (x_B-x_A)^2+ (y_B-y_A)^2 } }. \]

Raster Intersection

Two binary raster regions intersect if at least one cell is occupied by both.

If occupancy rasters are \(A\) and \(B\), intersection may be computed cellwise:

\[ \boxed{ I_{ij}=A_{ij}\land B_{ij} }. \]

This makes overlay operations very simple.

Vector Intersection

Vector intersection requires geometric predicates.

Depending on the objects, this may involve:

Raster Overlay

Multiple rasters on the same grid can be combined cell by cell.

For example, a suitability score might be

\[ S_{ij} = w_1A_{ij} + w_2B_{ij} + w_3C_{ij}. \]

This is one reason raster models are powerful in spatial analysis.

Vector Overlay

Vector overlay combines object boundaries to construct new geometry.

Polygon union, intersection, and difference may create:

The computation is more geometrically involved than simple cellwise arithmetic.

Raster Boolean Operations

Binary raster regions support direct logical operations:

\[ A\cap B \quad\leftrightarrow\quad A\land B, \] \[ A\cup B \quad\leftrightarrow\quad A\lor B, \] \[ A\setminus B \quad\leftrightarrow\quad A\land\neg B. \]

These operate independently on corresponding cells.

Vector Boolean Operations

Vector union, intersection, and difference preserve explicit geometric boundaries.

They require finding intersections and constructing the correct output topology.

This makes them more exact geometrically but also more algorithmically complex.

Resampling

A raster may need to be transferred to a new grid.

This is called resampling.

Common methods include:

Nearest-Neighbor Resampling

Nearest-neighbor resampling assigns each new cell the value of the nearest original sample.

It is fast and preserves original categorical values, but can create blocky results.

Bilinear Interpolation

Bilinear interpolation combines values from four neighboring grid samples.

It generally produces smoother results for continuous quantities than nearest-neighbor resampling.

It is not appropriate when category labels must remain unchanged.

Raster Reprojection

In geographic applications, changing coordinate reference systems can move raster cell centers away from their original regular grid.

The data must therefore be resampled onto a new grid after coordinate transformation.

Vector Coordinate Transformation

Vector coordinates can be transformed point by point.

For an affine transformation,

\[ \boxed{ X'=AX+\mathbf{b} } \]

can be applied directly to each vertex.

Curved objects may require transformation of control data or reevaluation.

Rasterization of a Line

A vector segment has infinitely many points.

A raster display must choose a finite set of pixels that best approximate that segment.

Line-rasterization algorithms aim to select pixels efficiently while keeping the displayed path visually close to the ideal line.

Rasterization of a Polygon

A filled vector polygon must be converted into covered pixels.

One strategy determines, for each scan line, where the polygon boundary is crossed and fills intervals between appropriate crossing pairs.

This connects rasterization with the ray-crossing logic used in point-in-region tests.

Scan-Line Filling

For a horizontal row, polygon edges intersect the scan line at several \(x\)-coordinates.

Under an even-odd filling rule, pixels between alternating intersection pairs are treated as interior.

Careful endpoint conventions prevent vertices from being counted twice.

Vectorization by Boundary Tracing

A binary raster region can be vectorized by identifying the boundary between occupied and unoccupied cells.

The resulting staircase boundary can then be:

Contour Extraction

For a scalar raster \(f_{ij}\), a contour approximates the level set

\[ f(x,y)=c. \]

Algorithms examine neighboring samples to estimate where the value \(c\) crosses cell edges.

The resulting line segments can be assembled into vector contours.

Marching Squares

Marching squares is a common two-dimensional contour extraction method.

Each grid cell is classified according to whether its corner samples lie above or below a threshold.

A local line pattern is then chosen to approximate the contour through that cell.

Three-Dimensional Analogue

In three dimensions, voxel grids provide raster-like volumetric representation.

Surface extraction methods such as marching cubes convert sampled scalar volumes into polygonal meshes.

This is a three-dimensional raster-to-vector conversion.

Voxels

A voxel is a volumetric grid cell.

A three-dimensional raster can be represented as

\[ R_{ijk}. \]

Voxels are used in medical imaging, scientific simulation, volume rendering, occupancy maps, and three-dimensional reconstruction.

Raster Precision and Grid Alignment

Raster comparisons are easiest when datasets share:

Misaligned grids require resampling or another reconciliation step.

Vector Precision

Vector coordinates are usually stored with finite numeric precision.

Geometrically exact relationships such as

\[ A=B \]

or

\[ \operatorname{orient}(A,B,C)=0 \]

may therefore be affected by floating-point representation.

Raster Error Is Often Resolution Error

Raster geometric error is strongly tied to cell size and sampling policy.

A feature narrower than one cell may disappear entirely.

A narrow gap may close.

A narrow connection may break.

Vector Error Is Often Coordinate or Model Error

Vector data can represent ideal geometric relationships, but errors may arise from:

Topology Can Change during Rasterization

Rasterization can alter connectedness.

Two nearby vector regions may merge into one pixel-connected component.

A thin vector bridge may vanish and split one region into two raster components.

Resolution therefore affects qualitative spatial structure as well as visual appearance.

Topology Can Change during Vectorization

Converting raster boundaries into vector geometry requires choices about:

These choices can change the reconstructed topology.

Vector Simplification

A detailed polyline may contain more vertices than necessary.

Simplification removes vertices while keeping the path within an accepted geometric error.

This reduces storage and rendering cost.

Approximation Tolerance

Suppose an original path is \(C\) and a simplified path is \(\tilde C\).

A simplification process may seek to keep deviation below a tolerance:

\[ \boxed{ d(C,\tilde C)\le\varepsilon }. \]

The exact distance definition depends on the algorithm.

Raster Compression

Raster datasets can often be compressed by exploiting repeated or predictable values.

Compression may be:

Vector Compression and Simplification

Vector files can be reduced by:

These methods change either storage structure or geometric fidelity.

Raster Data in GIS

Raster GIS is especially useful for:

Vector Data in GIS

Vector GIS is especially useful for:

Hybrid GIS Workflows

Real spatial analysis often uses both models.

A vector road network may be combined with:

Conversion and coordinate alignment become essential.

Raster Data in Computer Graphics

Displays are raster devices.

Final rendered images are ultimately represented as finite pixel arrays.

Textures, photographs, depth buffers, masks, and many intermediate renderings are also raster structures.

Vector Data in Computer Graphics

Vector graphics represent shapes through:

These are rasterized when displayed on a pixel-based screen.

Raster and Vector in Computer-Aided Design

Engineering design is predominantly vector- and object-based because exact dimensions, curves, surfaces, and relationships matter.

Raster images may still be used as:

Choosing a Representation

Ask what the data fundamentally represents.

If the phenomenon is a continuous field sampled everywhere, raster may be natural.

If the data consists of distinct geometric objects with important boundaries and relationships, vector may be natural.

Resolution versus Geometric Exactness

Raster representation provides explicit spatial resolution.

Vector representation provides explicit geometry.

The tradeoff can be summarized as:

\[ \boxed{ \text{sampled field structure} \quad\text{versus}\quad \text{coordinate-defined object structure} }. \]

Common Error: Saying Vector Has Infinite Precision

Vector geometry is resolution independent in concept, but computer coordinates are still stored with finite precision.

Vector representation avoids fixed pixel resolution; it does not eliminate numerical limitations.

Common Error: Assuming More Raster Pixels Always Mean Better Data

Increasing raster dimensions does not recover information that was never measured.

Upsampling a low-resolution image can create more pixels without creating new underlying spatial detail.

Common Error: Treating Rasterization as Exact

Rasterization converts continuous or vector geometry into a finite grid.

Boundary coverage depends on resolution, sample position, and filling policy.

Common Error: Treating Vectorization as a Perfect Inverse

Rasterization may discard geometric information.

Therefore, vectorization usually reconstructs an approximation rather than recovering a unique original object.

Common Error: Mixing Raster Grids without Alignment

Two rasters may have the same number of rows and columns while representing different physical locations.

Cell size, origin, orientation, and coordinate reference system must all be checked before cell-by-cell comparison.

Common Error: Ignoring Connectivity Convention

A diagonal pair of occupied raster cells is connected under an 8-neighbor rule but disconnected under a 4-neighbor rule.

Connectivity must therefore be defined explicitly.

Common Error: Using Raster for Exact Boundary Measurement without Qualification

Raster perimeter and area estimates depend on cell resolution and boundary approximation.

Exact vector geometry and raster approximations should not be treated as interchangeable without considering discretization error.

A Reliable Procedure for Rasterizing a Vector Region

  1. Choose the target grid origin and cell size.
  2. Choose the coordinate system.
  3. Define the cell-coverage rule.
  4. Identify cells near or inside the region.
  5. Apply scan-line, point-in-region, or coverage tests.
  6. Store occupancy or partial coverage.
  7. Verify boundary behavior on representative cases.

A Reliable Procedure for Vectorizing a Raster Region

  1. Define which raster values belong to the target region.
  2. Choose the connectivity convention.
  3. Locate boundaries between inside and outside cells.
  4. Trace connected boundary chains.
  5. Convert them into polylines or polygon rings.
  6. Simplify or smooth only under a stated tolerance.
  7. Verify holes, connectedness, and topology.

A Reliable Procedure for Choosing Raster or Vector

  1. Identify whether the data is primarily a field or a collection of objects.
  2. Determine how important exact boundaries are.
  3. Estimate required spatial resolution.
  4. Consider repeated operations such as overlay, intersection, or rendering.
  5. Consider storage and performance requirements.
  6. Account for coordinate transformations and interoperability.
  7. Use a hybrid workflow when both models provide important advantages.

Practice 1: Representation Type

A satellite photograph is stored as a \(4000\times3000\) array of color samples. Is this raster or vector representation?

Practice 2: Representation Type

A property parcel is stored as an ordered list of corner coordinates. Is this raster or vector representation?

Practice 3: Resolution

A \(100\)-meter-wide square region is stored as a \(500\times500\) raster. What is the cell width?

Practice 4: Resolution Growth

If both dimensions of a raster are doubled, by what factor does the number of cells increase?

Practice 5: Rasterization

What does rasterization convert?

Practice 6: Vectorization

Why is vectorization not generally a perfect inverse of rasterization?

Practice 7: Connectivity

Two occupied cells touch only at one corner. Are they connected under the 4-neighbor rule?

Practice 8: Scaling

Which representation can generally be enlarged without exposing a fixed underlying pixel grid: raster or vector?

Practice 9: GIS Choice

Which representation is more natural for a continuous elevation field: raster or vector?

Practice 10: GIS Choice

Which representation is more natural for a road network with explicit intersections and named segments?

Practice Answers

Practice 1

\[ \boxed{\text{raster}} \]

The image is stored as a regular grid of samples.

Practice 2

\[ \boxed{\text{vector}} \]

The parcel is represented by explicit geometric coordinates.

Practice 3

\[ \Delta x= \frac{100}{500} = \boxed{0.2\text{ meters}}. \]

Practice 4

Doubling both dimensions gives

\[ (2m)(2n)=4mn. \]

Therefore, the number of cells increases by

\[ \boxed{4}. \]

Practice 5

Rasterization converts

\[ \boxed{ \text{vector or continuous geometry into grid cells or pixels} }. \]

Practice 6

Rasterization can discard geometric information through finite sampling and quantization, so the original vector geometry may not be uniquely recoverable.

Practice 7

No. Diagonal contact does not count under four-neighbor connectivity.

\[ \boxed{\text{No}.} \]

Practice 8

\[ \boxed{\text{vector}} \]

Vector geometry can be reevaluated at a new display scale.

Practice 9

\[ \boxed{\text{raster}} \]

A continuously varying elevation field is naturally sampled over a grid.

Practice 10

\[ \boxed{\text{vector}} \]

Roads and intersections are distinct geometric and topological objects.

What to Remember

Raster and vector representations encode spatial information in different ways.

The larger computational principle is that the representation is part of the algorithm. The same spatial object can behave very differently in computation depending on whether it is encoded as sampled cells or explicit geometry.

Where We Go Next

Raster and vector representation explains how geometry can be encoded for computation. The next lesson turns to one of the most important systems built around exact vector geometry and constructive spatial modeling.

Computer-Aided Design develops the geometric principles behind digital drafting, parametric construction, constraints, curves, surfaces, solids, and precise engineering models.