Motivation
It’s important that different datasets are compatible with each-other prior to analysis.
- All datasets should be in the same CRS (datum and projection)
- Rasters should be “co-registered”: matching grids (resolution and orientation)
- Optional: Don’t keep data you don’t need
- Change to data model (raster <-> vector)
Resampling
Generation of a new sample from existing data.
Raster Resampling
gdalwarp
Raster grids will not always align, even in the same projection & datum.
Resampling: interpolation
Resampling: vectors
ogr2ogr
Change the frequency/density of verticies in lines and polygons
Reprojection
Reprojection (via PyGIS)
Raster Reprojection
gdal_warp
When raster data is reprojected, data points are usually not mapped 1:1.
A “warped” reprojection (via PyGIS)
Vector reprojection
ogr2ogr
Vector reprojection only affects vertices / points.
Reprojection pitfalls
Weird things happen at the edges!
- Vector geometry can become invalid.
- Raster data can show a “seam” where edges are warped together.
A “seam” along 180 degrees longitude in QGreenland’s Natural Earth basemap
On-the-fly reprojection
Subsetting (clipping)
gdalwarp
, ogr2ogr
Consider doing a subset first. Don’t waste time and computing power doing analysis on areas you don’t care about!
QGreenland’s Natural Earth 2 basemap without subsetting. QGreenland’s area of interest is the tiny circle in the center!
Conversion
gdal_rasterize, gdal_polygonize.py, gdal_contour
Does your data provide a suitable representation for your analysis?
Johannes Rössel, CC BY-SA 3.0 https://creativecommons.org/licenses/by-sa/3.0, via Wikimedia Commons
Conversion: Raster to vector
QGreenland’s Heat Flux layer (raster) with contours overlaid