Inputs do not occupy the same physical space
Hello, I am working with multiples .tif. My code on my server works with the 6.6.1 version of OTB. On local I'm on the 8.8.1 version and I get the error "Inputs do not occupy the same physical space!"
Description
Here are my two .tif files with gdalinfo command:
Driver: GTiff/GeoTIFF
Files: /var/www/cartestif/A18/P1Z175_BRc.tif
Size is 29, 37
Coordinate System is:
PROJCRS["WGS 84 / UTM zone 31N",
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 31N",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",0,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",3,
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",0,
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["Engineering survey, topographic mapping."],
AREA["Between 0°E and 6°E, northern hemisphere between equator and 84°N, onshore and offshore. Algeria. Andorra. Belgium. Benin. Burkina Faso. Denmark - North Sea. France. Germany - North Sea. Ghana. Luxembourg. Mali. Netherlands. Niger. Nigeria. Norway. Spain. Togo. United Kingdom (UK) - North Sea."],
BBOX[0,0,84,6]],
ID["EPSG",32631]]
Data axis to CRS axis mapping: 1,2
Origin = (340349.066190032404847,4830673.628928044810891)
Pixel Size = (10.000000000000000,-10.000000000000000)
Metadata:
AREA_OR_POINT=Area
DataType=1
METADATATYPE=OTB
OTB_VERSION=8.1.1
TileHintX=29
TileHintY=37
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 340349.066, 4830673.629) ( 1d 1'17.64"E, 43d36'42.94"N)
Lower Left ( 340349.066, 4830303.629) ( 1d 1'18.03"E, 43d36'30.95"N)
Upper Right ( 340639.066, 4830673.629) ( 1d 1'30.57"E, 43d36'43.16"N)
Lower Right ( 340639.066, 4830303.629) ( 1d 1'30.96"E, 43d36'31.18"N)
Center ( 340494.066, 4830488.629) ( 1d 1'24.30"E, 43d36'37.06"N)
Band 1 Block=29x37 Type=Float32, ColorInterp=Gray
And my second file:
Driver: GTiff/GeoTIFF
Files: /var/www/cartestif/A18/P1Z175_ori.tif
Size is 29, 37
Coordinate System is:
PROJCRS["WGS 84 / UTM zone 31N",
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 31N",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",0,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",3,
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",0,
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["Engineering survey, topographic mapping."],
AREA["Between 0°E and 6°E, northern hemisphere between equator and 84°N, onshore and offshore. Algeria. Andorra. Belgium. Benin. Burkina Faso. Denmark - North Sea. France. Germany - North Sea. Ghana. Luxembourg. Mali. Netherlands. Niger. Nigeria. Norway. Spain. Togo. United Kingdom (UK) - North Sea."],
BBOX[0,0,84,6]],
ID["EPSG",32631]]
Data axis to CRS axis mapping: 1,2
Origin = (340349.065999999991618,4830673.628999999724329)
Pixel Size = (10.000000000000000,-10.000000000000000)
Metadata:
AREA_OR_POINT=Area
DataType=1
METADATATYPE=OTB
OTB_VERSION=8.1.1
TileHintX=29
TileHintY=37
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 340349.066, 4830673.629) ( 1d 1'17.64"E, 43d36'42.94"N)
Lower Left ( 340349.066, 4830303.629) ( 1d 1'18.03"E, 43d36'30.95"N)
Upper Right ( 340639.066, 4830673.629) ( 1d 1'30.57"E, 43d36'43.16"N)
Lower Right ( 340639.066, 4830303.629) ( 1d 1'30.96"E, 43d36'31.18"N)
Center ( 340494.066, 4830488.629) ( 1d 1'24.30"E, 43d36'37.06"N)
Band 1 Block=29x37 Type=Float32, ColorInterp=Gray
NoData Value=0
Steps to reproduce
When I run the command: otbcli_BandMath -il /var/www/cartestif/A18/P1Z175_BRc.tif /var/www/cartestif/A18/P1Z175_ori.tif -out /var/www/cartestif/A18/P1Z175_PZ.tif -exp "im2b1 == 0 ? (im1b1) : im2b1"
I get the error:
array(13) {
[0]=>
string(66) "2023-08-18 17:25:44 (INFO): Loading metadata from official product"
[1]=>
string(66) "2023-08-18 17:25:44 (INFO): Loading metadata from official product"
[2]=>
string(72) "2023-08-18 17:25:44 (INFO) BandMath: Default RAM limit for OTB is 256 MB"
[3]=>
string(70) "2023-08-18 17:25:44 (INFO) BandMath: GDAL maximum cache size is 297 MB"
[4]=>
string(67) "2023-08-18 17:25:44 (INFO) BandMath: OTB will use at most 8 threads"
[5]=>
string(62) "2023-08-18 17:25:44 (INFO) BandMath: Image #1 has 1 components"
[6]=>
string(0) ""
[7]=>
string(62) "2023-08-18 17:25:44 (INFO) BandMath: Image #2 has 1 components"
[8]=>
string(0) ""
[9]=>
string(132) "2023-08-18 17:25:44 (FATAL) BandMath: itk::ERROR: BandMathImageFilter(0x558b0fa9fa40): Inputs do not occupy the same physical space!"
[10]=>
string(102) "InputImage Origin: [3.4035407e+05, 4.8306686e+06], InputImage_1 Origin: [3.4035407e+05, 4.8306686e+06]"
[11]=>
string(25) " Tolerance: 1.0000000e-05"
[12]=>
string(0) ""
as you can see the origins are the same. I don't understand why it thinks their is an offset. And my two .tif files are generated from the same .tif file with
gdalwarp -q -dstnodata 0 -tr 10.0 10.0 -te 340349.066 4830303.629 340639.066 4830673.629 -of GTiff -overwrite /var/www/cartestif/A18/P1Z181.tif /var/www/cartestif/A18/P1Z181_ori.tif
Configuration information
My code is running on a PHP docker, with last OTB-bin stable version 8.1.1
Thanks