The Geospatial Data Abstraction Library (GDAL) is a open-source software library for handling geospatial imagery data.
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
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
TransformPoint is that you can do many points at once, making things more efficient).
- Top left X
- W-E pixel resolution (pixel size y*sin(res))
- Top left Y
- N-S pixel resolution
The upper left corner of the upper left pixel will be placed at position gt, gt.
If your projection was to WGS84 (lat, lon) then:
gt: Longitude of top left corner gt: cos(alpha)*W-E resolution gt: -sin(alpha_*W-E resolution) gt: Latitude of top left corner gt: sin(alpha)*N-S resolution gt: cos(alpha)*N-S resolution
This work is licensed under a Creative Commons Attribution 4.0 International License .