Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
podcast
Filter by Categories
ArcGIS Pro
GDAL
GeoJson
Map
Python
QGIS
Uncategorized

Reprojecting Rasters

What is reprojection

Reprojecting is a common task in GIS when working with multiple data layers or when the data needs to be in a specific format for analysis or visualization. This process involves changing the spatial reference system of a raster dataset, which can be done to align it with other datasets by changing the coordinate system.

In this article, we will discuss the steps and methods for reprojecting rasters using different GIS software such as ArcGIS, QGIS, and GDAL. We will also explore the concepts of interpolation, resampling, and their importance in the reprojection process.

Want to stay ahead of the curve in GIS? Listen to our podcast!

What are interpolation and resampling?

In the context of reprojecting rasters, interpolation and resampling refer to the process of estimating new values for pixels in the output raster based on the values of the pixels in the input raster.

Interpolation is the process of estimating new values for pixels in the output raster based on the values of the pixels in the input raster. It is used to estimate the value of a pixel based on the values of the surrounding pixels. There are various interpolation methods available such as nearest neighbor, bilinear, cubic, and others. These methods vary in terms of the complexity of the calculations and the quality of the results.

Resampling is the process of creating a new raster with a different cell size or resolution. The output raster will have a different number of pixels than the input raster. The software will use interpolation methods to estimate the value of each new pixel in the output raster based on the values of the pixels in the input raster.

Both interpolation and resampling are important because they allow the software to create a new raster that has the desired spatial reference system and resolution. Without these processes, the output raster would be a low-resolution or low-quality version of the input raster. With interpolation and resampling, the software can create an output raster that accurately represents the data in the input raster in the desired spatial reference system and resolution.

The reprojection process itself does not affect the number of pixels in the raster. However, when the raster is reprojected, the cell size or resolution of the raster may change. The process of adjusting the cell size or resolution of the raster is resampling.

When a raster is reprojected, the cells may need to be resized to align with the new coordinate system. For example, if the raster is being reprojected to a different coordinate system with a different spatial resolution, the cells in the output raster may need to be larger or smaller to match the resolution of the new coordinate system.

Also, when the raster is reprojected, the georeferencing information, such as the position, orientation, or rotation of the raster, may change. The process of adjusting the georeferencing information of the raster is also known as resampling.

So, resampling and interpolation are needed when reprojecting a raster because they allow the software to create an output raster that accurately represents the data in the input raster in the desired spatial reference system and resolution.

Reprojecting a raster in QGIS

Reprojecting a raster in QGIS involves the following steps:

  1. Open QGIS and add the raster layer that you want to reproject.
  2. Right-click on the layer in the layer list and select “Save As…” from the context menu.
  3. In the “Save As” dialog box, select the location and name for the output raster.
  4. Under the “CRS” (coordinate reference system) option, select the target CRS for the output raster. This can be done by searching for the desired CRS or by selecting it from the list of predefined CRS.
  5. In the “Save As” dialog box, select the “Raster” format and the desired compression method.
  6. Click “OK” to start the reprojection process. The software will use interpolation techniques to resample the raster data and create the new output raster with the desired spatial reference system.
  7. Once the process is complete, the new raster will be added to the map. You can then verify if the new raster is correctly reprojected by comparing it to other rasters in the same map, or by comparing the coordinates of the new raster to the desired ones.
  8. If you want to make sure that the new raster has the correct CRS set, you can right-click on the layer in the layer list and select “Properties.” In the Properties dialog box, you can verify the CRS of the raster.

Note that some of the steps may vary depending on the version of QGIS you are using. Also, you can also use the Raster > Projections > Warp (Reproject) option from the menu to reproject a raster.

Reprojecting a raster in GDAL

Reprojecting a raster using GDAL involves the following steps:

  1. Open the command prompt or terminal on your computer.
  2. Use the command “gdalwarp” to start the reprojection process. The basic syntax for this command is:
gdalwarp [options] input_raster output_raster
  1. Specify the input raster file by providing its file path after the “gdalwarp” command.
  2. Specify the output raster file by providing its file path after the input raster file path.
  3. Use the option -t_srs to specify the target coordinate system for the output raster. The syntax is:
-t_srs target_CRS

Where “target_CRS” is the EPSG code or Proj4 string of the desired coordinate system.

  1. Use the option -r to specify the resampling method. The options are nearest neighbor, bilinear, cubic, cubic spline, and Lanczos. The syntax is:
-r resampling_method
  1. Use the option -multi if you want to create a multi-page TIFF file
  2. Use option -overwrite if you want to overwrite existing files.
  3. Run the command. The software will use the specified options to resample the input raster and create the new output raster with the desired spatial reference system.
  4. Once the process is complete, you can use the command “gdalinfo” to verify the coordinate system of the output raster.
gdalinfo output_raster

Note that you can use other options and flags like -tr (to set the output resolution), -te (to set the output extent) among others. The GDAL documentation provides a comprehensive list of all the options and flags available for the gdalwarp command.

Reprojecting a raster in ArcGIS

Reprojecting a raster in ArcGIS involves the following steps:

  1. Open ArcMap and add the raster layer that you want to reproject.
  2. Right-click on the layer in the table of contents and select “Data” -> “Export” from the context menu.
  3. In the “Export Raster” dialog box, select the location and name for the output raster.
  4. Under the “Coordinate System” option, select the target CRS for the output raster. This can be done by searching for the desired CRS or by selecting it from the list of predefined CRS.
  5. In the “Export Raster” dialog box, select the “Raster format” and the desired compression method.
  6. Click “OK” to start the reprojection process. The software will use interpolation techniques to resample the raster data and create the new output raster with the desired spatial reference system.
  7. Once the process is complete, the new raster will be added to the map. You can then verify if the new raster is correctly reprojected by comparing it to other rasters in the same map, or by comparing the coordinates of the new raster to the desired ones.
  8. If you want to make sure that the new raster has the correct CRS set, you can right-click on the layer in the table of contents, select “Properties” and go to the “Source” tab. In this tab, you can verify the CRS of the raster.

Note that some of the steps may vary depending on the version of ArcGIS you are using, also you can use the Project Raster tool to reproject a raster layer. This tool can be found in the Data Management Tools > Projections and Transformations toolbox.

Reprojecting a raster in Python

There are several libraries in Python that can be used to reproject rasters, such as GDAL, rasterio, and arcpy. Below is an example of how to use the GDAL library to reproject a raster:

from osgeo import gdal

# Open the input raster
input_raster = gdal.Open("input_raster.tif")

# Get the projection of the input raster
input_projection = input_raster.GetProjection()

# Get the target projection
target_projection = 'EPSG:3857' # for example

# Set the options for the gdalwarp command
options = gdal.WarpOptions(dstSRS=target_projection, resamplingAlg=gdal.GRA_Cubic)

# Reproject the raster
output_raster = gdal.Warp("output_raster.tif", input_raster, options=options)

In the above example, the input raster is opened using the gdal.Open() function. The projection of the input raster is obtained using the GetProjection() method, and the target projection is specified as EPSG:3857. The resampling algorithm used in this example is gdal.GRA_Cubic.

The gdal.Warp() function is used to perform the reprojection, with the first argument specifying the output file, the second argument specifying the input file and the options specifying the target projection and the resampling algorithm.

You can use similar commands to use the rasterio library to reproject a raster. Also, you can use the arcpy module of ArcGIS to perform the same task, using the ProjectRaster function.

Raster Reprojection FAQs

Can I reproject a raster without resampling it?

Yes, it is possible to reproject a raster without resampling it, by using the option -dstnodata or -tap option in the gdalwarp command or similar options in other GIS software. This option preserves the original raster resolution and dimensions, but the georeferencing information will be updated to match the new coordinate system

What is the difference between on-the-fly reprojection and offline reprojection?

On-the-fly reprojection refers to the process of reprojecting a raster as it is being displayed or analyzed, without modifying the original raster. Offline reprojection refers to the process of creating a new raster with a different spatial reference system, based on the original raster.

What is the difference between reprojecting and re-projecting?

“Reproject” and “re-project” are used interchangeably, they refer to the process of changing the spatial reference system of a raster dataset.

How do I choose the right interpolation method for my raster?

Choosing the right interpolation method depends on the characteristics of the data and the purpose of the reprojection. Some interpolation methods work better for smooth, continuous data, while others work better for discrete or categorical data. It’s a good idea to test different interpolation methods to see which one produces the best results for your data.

About the Author
I'm Daniel O'Donohue, the voice and creator behind The MapScaping Podcast ( A podcast for the geospatial community ). With a professional background as a geospatial specialist, I've spent years harnessing the power of spatial to unravel the complexities of our world, one layer at a time.

Leave a Reply