Vector vs Raster¶
Goal: Stop second-guessing this. Know exactly when to use vector and when to use raster.
The 10-second version¶
| Vector | Raster | |
|---|---|---|
| What | Discrete shapes (point, line, polygon) | Grid of cells (pixels) |
| Best for | Things with crisp edges (buildings, roads, parcels) | Continuous phenomena (elevation, temperature) |
| File | Shapefile, GeoPackage, geodatabase | GeoTIFF, NetCDF, JPEG2000 |
| Scales how? | Looks sharp at any zoom | Pixelates when zoomed in |
| Storage | Small | Big |
| Math | Geometric (areas, lengths) | Cell-based (algebra, surfaces) |
Visual¶
VECTOR ▭ ─── ● RASTER ┌─┬─┬─┬─┐
parcel road point │░│▒│▓│▒│
├─┼─┼─┼─┤
│░│▒│▓│▓│
└─┴─┴─┴─┘
Discrete Cells with values
shapes (elevation, NDVI, …)
When vector wins¶
✅ Use vector when:
- The thing has a clear boundary — a building, a parcel, a stream.
- You need to attach attributes (population, owner, name).
- You'll measure length / area / perimeter.
- The output goes to print at varying scales (vectors stay crisp).
- You'll edit the data interactively.
When raster wins¶
✅ Use raster when:
- The phenomenon is continuous — elevation, temperature, NDVI, rainfall.
- You're doing map algebra (calculate slope from elevation, NDVI from bands).
- You're working with imagery (satellite, aerial, drone).
- You need a pixel-by-pixel analysis (suitability, change detection).
- You want a density / heatmap surface.
The hybrid¶
Most real workflows mix both:
| Task | Format |
|---|---|
| Polygons of land use | Vector |
| Elevation → slope | Raster |
| "Forest with slope > 15%" | Vector ∪ Raster (Extract by Mask) |
| Population density from points | Raster (kernel density) |
| Wildfire-risk model | Both (vector roads + raster fuels) |
Conversion¶
You'll convert between them often:
- Polygon → Raster — Polygon to Raster tool. E.g., zoning polygons → input to weighted overlay.
- Raster → Polygon — Raster to Polygon tool. E.g., classified land cover → polygons.
- Points → Density raster — Kernel Density tool.
- Raster cells → Points — Raster to Point tool.
Storage tradeoffs¶
A US-wide vector layer of all roads might be 300 MB. A US-wide DEM at 10 m might be 30 GB.
Why? Vector stores only vertices. Raster stores every cell, even empty ones.
For huge rasters, use Cloud-Optimized GeoTIFF (COG) — you can read just the part you need without downloading the whole file.
Common confusions¶
Things people get wrong
- 🚫 "I'll convert my Landsat imagery to vectors" → No. Imagery is raster forever.
- 🚫 "I'll buffer a raster" → Use Euclidean Distance instead.
- 🚫 "I'll do raster math on parcels" → Convert to raster first.
Performance notes¶
- Vector spatial joins are O(n × m) without an index. Add a Spatial Index.
- Raster operations are O(cells). A 4× resolution increase = 16× more cells = ~16× slower.
Practice¶
Decide before you do
For each task, write down: vector or raster?
- "Average elevation inside each watershed" → ?
- "Population per zip code" → ?
- "All buildings within 50 m of a highway" → ?
- "Vegetation health change 2014 → 2024" → ?
- "Streets crossing the floodplain" → ?
Answers: 1) Both (raster zonal stats over vector zones), 2) Vector, 3) Vector, 4) Raster, 5) Vector intersect.