GDAL
The Geospatial Data Abstraction Library (GDAL) is a open-source software library for handling geospatial imagery data.
RPC Metadata
The command-line tool gdalinfo
will print the RPC metadata if present.
Basic Reading/Writing Of GeoTiff Files
Updating the same file is the simplest example, as you don’t have to worry about creating a driver:
Always Make Sure To dataset=None
Until a dataset
object is set to None
in Python, you cannot guarantee that all of the data has been written to the file system.
Converting x, y Pixel Coordinates To Lat/Lons Using RPCs
RPC metadata can be embedded within an non-orthorectified image file. GDAL can use this RPC metadata to convert (or transform) co-ordinates in x, y pixels space into latitude/longitudes (and also to perform the reverse, to calculate x/y pixel co-ordinates from lat/lons).
You can do this in GDAL with a Transformer
and the TransformPoints()
function. However, these are quite poorly documented online (the benefit of TransformPoints()
over TransformPoint
is that you can do many points at once, making things more efficient).
The geotransform
- Top left X
- W-E pixel resolution (pixel size y*sin(res))
- Rotation
- Top left Y
- Rotation
- N-S pixel resolution
The upper left corner of the upper left pixel will be placed at position gt[0], gt[3].
If your projection was to WGS84 (lat, lon) then: