I've been trying to rectify an unprojected raster (with RPC model) with digital surface model (DSM) by using gdalwarp command. Here is the command:
gdalwarp \
-co BIGTIFF=YES \
-co "TILED=YES" \
-r cubic -wo SAMPLE_GRID=NO \
-et 0 -t_srs EPSG:32756 \
-rpc -to RPC_DEM=dsm.tif \
IMG_PNEO3_202208070015388_PAN_SEN_PWOI_000028299_1_33_F_1_P_R1C1.tif \
rectify.tif
But it failed with the error:
ERROR 1: Too many points (10201 out of 10201) failed to transform, unable to compute output bounds.
Few things to note about this command:
- No
-s_srs: the input image is PleiadesNeo image from Airbus, and it's unprojected. So, I cannot put a specific CRS to this parameter. - The input image is large and the
dsm.tifis a bit smaller than the input image. -et 0: it's used because I follow this GIS question.
Also, for the completeness sake, I show all details of input data below.
- Folder structure:
$ tree
.
├── DIM_PNEO3_202208070015388_PAN_SEN_PWOI_000028299_1_33_F_1_P.XML
├── dsm.tif
├── IMG_PNEO3_202208070015388_PAN_SEN_PWOI_000028299_1_33_F_1_P_R1C1.tif
├── RPC_PNEO3_202208070015388_PAN_SEN_PWOI_000028299_1_33_F_1_P.XML
- Meta data:
DIM_PNEO3_202208070015388_PAN_SEN_PWOI_000028299_1_33_F_1_P.XMLandRPC_PNEO3_202208070015388_PAN_SEN_PWOI_000028299_1_33_F_1_P.XMLare metadata of the imageIMG_PNEO3_202208070015388_PAN_SEN_PWOI_000028299_1_33_F_1_P_R1C1.tif. - The image: here is the image info of
gdalinfooutput:
$ gdalinfo IMG_PNEO3_202208070015388_PAN_SEN_PWOI_000028299_1_33_F_1_P_R1C1.tif
Driver: GTiff/GeoTIFF
Files: IMG_PNEO3_202208070015388_PAN_SEN_PWOI_000028299_1_33_F_1_P_R1C1.tif
./DIM_PNEO3_202208070015388_PAN_SEN_PWOI_000028299_1_33_F_1_P.XML
./RPC_PNEO3_202208070015388_PAN_SEN_PWOI_000028299_1_33_F_1_P.XML
Size is 40049, 96797
Origin = (0.500000000000000,-0.500000000000000)
Pixel Size = (1.000000000000000,-1.000000000000000)
Metadata:
METADATATYPE=DIMAP
Image Structure Metadata:
INTERLEAVE=PIXEL
RPC Metadata:
HEIGHT_OFF=560.7050933837891
HEIGHT_SCALE=243.97776794433594
LAT_OFF=-24.712618896561807
LAT_SCALE=0.13565707454044684
LINE_DEN_COEFF=
LINE_NUM_COEFF=
LINE_OFF=48397.5
LINE_SCALE=48398.5
LONG_OFF=150.8886406778467
LONG_SCALE=0.0614407064336433
SAMP_DEN_COEFF=
SAMP_NUM_COEFF=
SAMP_OFF=20023.5
SAMP_SCALE=20024.5
Corner Coordinates:
Upper Left ( 0.5000000, -0.5000000)
Lower Left ( 0.500, -96797.500)
Upper Right ( 40049.500, -0.500)
Lower Right ( 40049.500, -96797.500)
Center ( 20025.000, -48399.000)
Band 1 Block=40049x1 Type=UInt16, ColorInterp=Gray
Band 2 Block=40049x1 Type=UInt16, ColorInterp=Undefined
Band 3 Block=40049x1 Type=UInt16, ColorInterp=Undefined
Band 4 Block=40049x1 Type=UInt16, ColorInterp=Undefined
Band 5 Block=40049x1 Type=UInt16, ColorInterp=Undefined
Band 6 Block=40049x1 Type=UInt16, ColorInterp=Undefined
As you see, gdalinfo pick up the metadata (RPC). And this image is not projected. The origin starts from (0.5,-0.5). The size of it is (40049, 96797).
dsm.tif: Here is the info ofdsm.tif.
$ gdalinfo dsm.tif
Driver: GTiff/GeoTIFF
Files: dsm.tif
Size is 42434, 98773
Coordinate System is:
PROJCRS["WGS 84 / UTM zone 56S",
BASEGEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4326]],
CONVERSION["UTM zone 56S",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",0,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",153,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",0.9996,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",500000,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",10000000,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["(E)",east,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["(N)",north,
ORDER[2],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["unknown"],
AREA["World - S hemisphere - 150°E to 156°E - by country"],
BBOX[-80,150,0,156]],
ID["EPSG",32756]]
Data axis to CRS axis mapping: 1,2
Origin = (280010.700000000011642,7280064.599999999627471)
Pixel Size = (0.300000000000000,-0.300000000000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
COMPRESSION=DEFLATE
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 280010.700, 7280064.600) (150d49'39.53"E, 24d34'40.11"S)
Lower Left ( 280010.700, 7250432.700) (150d49'22.80"E, 24d50'42.84"S)
Upper Right ( 292740.900, 7280064.600) (150d57'11.85"E, 24d34'46.44"S)
Lower Right ( 292740.900, 7250432.700) (150d56'56.08"E, 24d50'49.25"S)
Center ( 286375.800, 7265248.650) (150d53'17.59"E, 24d42'44.71"S)
Band 1 Block=256x256 Type=Float32, ColorInterp=Gray
NoData Value=-999999
- The
dsm.tifsize is also quite large,42434, 98773. And its resolution is 0.3 meter. - Its CRS is
EPSG:32756, which can also be confirmed withgdalsrsinfocommand.
$ gdalsrsinfo dsm.tif
Warning 1: OSR_USE_ETMERC is a legacy configuration option, which now has only effect when set to NO (YES is the default). Use OSR_USE_APPROX_TMERC=YES instead
PROJ.4 : +proj=utm +zone=56 +south +datum=WGS84 +units=m +no_defs
OGC WKT2:2018 :
PROJCRS["WGS 84 / UTM zone 56S",
BASEGEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4326]],
CONVERSION["UTM zone 56S",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",0,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",153,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",0.9996,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",500000,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",10000000,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["(E)",east,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["(N)",north,
ORDER[2],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["unknown"],
AREA["World - S hemisphere - 150°E to 156°E - by country"],
BBOX[-80,150,0,156]],
ID["EPSG",32756]]
Last thing to note is that this command has been used extensively on similar images, but it fails on this image.
what does the error message mean and how to solve it?
There are quite a few similar GIS question, this, this, this, this and this, but none of them can solve my issue unfortunately.
Another note is that even though my input image is not projected, I am still quite confident that it's not an issue if RPC model and an external DEM are given. Because essentially what RPC does is to map pixel coordinates to geographic coordinates with the height information, which is exactly what I am trying to do in this question.
Geographic Coord = RPC+ Height(DSM)
I found a way to make it work for my purpose, but I don't know the root cause of it. Here is what I do. Originally the experiment was done in the cloud service and the environment in the cloud is the following:
- Ubuntu 20.04
apt isntall gdal-bin: it installsgdal-3.0.
In order to debug it, I download the file to my laptop and run the exact same command, and it works. And the gdal version in my laptop is gdal-3.5.0.
I was thinking that the rule of thumb is to always use the latest GDAL release, but it's not the case. Using gdal-3.6.3 will also fail but with different error message. Here I show all message for all the environments I've tried:
GDAL 3.0: The command failed.
ERROR 1: Too many points (10201 out of 10201) failed to transform, unable to compute output bounds.
GDAL 3.5.0: The command succeeded even though it output the same error message.
Processing /efs/chihan/test_stereo_output/pneo/test-output-tobedeleted/stereo_source/ortho/IMG_PNEO3_202208070015388_PAN_SEN_PWOI_000028299_1_33_F_1_P_R1C1.tif [1/1] : 0ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 0,25250,1686,2806, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 0,28056,3373,5612, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 3373,30862,1686,2806, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 0,33668,6746,11223, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 6746,36473,1686,2806, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 6746,39279,3373,5612, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 10119,42085,1686,2806, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 26985,0,6746,5611, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 28671,5611,1687,2805, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 30358,5611,3373,5611, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 33731,0,6746,11222, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 32044,11222,1687,2805, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 33731,11222,6746,5611, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 35417,16833,1687,2806, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 37104,16833,3373,5612, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 40477,0,13493,22445, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 38790,22445,1687,2805, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 40477,22445,6746,5611, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 42163,28056,1687,2806, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 43850,28056,3373,5612, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 47223,22445,6747,11223, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 43850,33668,3373,2805, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 45536,36473,1687,2806, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 45536,39279,1687,2806, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 47223,33668,6747,11223, skipping.
ERROR 1: Too many points (525 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 0,44891,13492,22445, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 13492,47696,1686,2806, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 13492,50502,1686,2805, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 13492,53307,3373,2806, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 13492,56113,3373,5611, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 13492,61724,3373,5612, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 16865,64530,1686,2806, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 0,67336,13492,22446, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 13492,67336,6746,11223, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 20238,75753,1686,2806, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 13492,78559,6746,11223, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 20238,78559,1686,2805, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 20238,81364,1686,2806, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 20238,84170,3373,5612, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 47223,44891,6747,5611, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 48909,50502,1687,2805, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 48909,53307,1687,2806, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 50596,50502,3374,5611, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 48909,56113,1687,2805, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 50596,56113,3374,5611, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 52283,61724,1687,2806, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 52283,64530,1687,2806, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 52283,67336,1687,2805, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 42163,82767,1687,1403, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 43850,82767,1686,1403, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 45536,82767,1687,1403, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 42163,84170,1687,2806, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 42163,86976,1687,2806, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 43850,84170,3373,5612, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 47223,82767,1686,1403, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 48909,82767,1687,1403, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 50596,82767,1687,1403, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 52283,82767,1687,1403, skipping.
ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds.
Warning 1: Unable to compute source region for output window 47223,84170,6747,5612, skipping.
...10...20...30...40...50...60...70...80...90...100 - done.
GDAL 3.6.3: The command failed and the error message is not expected. The reason why I think it's unexpected is that this command has run over many similar images and it never complains about not being able to find metadata. The associated meta file isRPC_PNEO3_202208070015388_PAN_SEN_PWOI_000028299_1_33_F_1_P.XML.
ERROR 1: Unable to compute a RPC based transformation between pixel/line and georeferenced coordinates for /efs/chihan/test_stereo_output/pneo/axel4/stereo_source/ortho/IMG_PNEO4_202303160016323_PAN_SEN_PWOI_000072101_1_5_F_1_P_R1C1.tif.