16.26. geodiff¶
The geodiff program takes as input two DEMs, or a DEM and a CSV file, and
subtracts the second from the first. The grid is from the first DEM, so the
second one is interpolated into it using bilinear interpolation. When one file
is a CSV, the grid from the DEM is used, regardless of the order of inputs. Use
--reverse to flip the sign of the output while keeping the same grid.
It is important to note that geodiff is very sensitive to the order of
the two DEMs, due to the fact that the grid comes from the first one.
Ideally the grid of the first DEM would be denser than the one of the
second.
Usage:
geodiff [options] <dem1> <dem2> [ -o output_prefix ]
16.26.1. Examples¶
16.26.1.1. Absolute difference of two DEMs¶
geodiff --absolute dem1.tif dem2.tif -o run
This creates run-diff.tif, with values equal to |dem1 - dem2| on the
grid of dem1.
The stereo_gui program (Section 16.72.5) can colorize on-the-fly and
display the difference image. The colormap program (Section 16.14) can
write a colorized image.
16.26.1.2. DEM 1 minus DEM 2¶
Subtract the second DEM from the first DEM. This is the default:
geodiff dem1.tif dem2.tif -o run
This creates run-diff.tif, with values equal to dem1 - dem2 on the
grid of dem1.
16.26.1.3. DEM 2 minus DEM 1¶
Use --reverse to flip the sign, while still using the grid of the first
DEM:
geodiff --reverse dem1.tif dem2.tif -o run
This creates run-diff.tif, with values equal to dem2 - dem1 on the
grid of dem1.
16.26.1.4. Difference of a DEM and a CSV file¶
Take the difference of a DEM and a CSV file:
geodiff dem1.tif file.csv \
--csv-format '1:lon 2:lat 3:height_above_datum' \
-o run
The --csv-format option specifies the meaning of the CSV columns. See
Section 19.12 for the full description of the supported formats.
This creates run-diff.csv, holding the DEM height minus the CSV height,
sampled on the DEM’s grid. The grid comes from the DEM regardless of the input
order. Add --reverse to flip the sign.
The produced run-diff.csv file can be visualized and colorized with
stereo_gui (Section 16.72.6), as:
stereo_gui --colorbar run-diff.csv
This program can also overlay the difference on top of the DEM.
16.26.2. See also¶
The image_calc program (Section 16.33) can perform many operations on
images, as long as they are the same size (use gdalwarp,
Section 16.25, to convert images to the same extent and georeference).
16.26.3. Command-line options¶
- -o, --output-prefix <filename>
Specify the output prefix.
- --absolute
Output the absolute difference as opposed to just the difference.
- --reverse
Reverse the sign of the difference while keeping the output on the same grid.
- --csv-format <string>
Specify the format of input CSV files as a list of entries column_index:column_type (indices start from 1). Examples:
1:x 2:y 3:z(a Cartesian coordinate system with origin at planet center is assumed, with the units being in meters),5:lon 6:lat 7:radius_m(longitude and latitude are in degrees, the radius is measured in meters from planet center),3:lat 2:lon 1:height_above_datum,1:easting 2:northing 3:height_above_datum(need to set--csv-srs; the height above datum is in meters). Can also use radius_km for column_type, when it is again measured from planet center. See Section 19.12 for details.- --csv-srs <proj string>
The PROJ or WKT string to use to interpret the entries in input CSV files, if those files contain Easting and Northing fields. If not specified, it will be borrowed from the DEM.
- --nodata-value <float (default: -32768)>
The no-data value to use, unless present in the DEM geoheaders.
- --threads <integer (default: 0)>
Select the number of threads to use for each process. If 0, use the value in ~/.vwrc.
- --cache-size-mb <integer (default = 1024)>
Set the system cache size, in MB.
- --tile-size <integer (default: 256 256)>
Image tile size used for multi-threaded processing.
- --no-bigtiff
Tell GDAL to not create BigTiff files.
- --float
Output using float (32 bit) instead of using doubles (64 bit). This is now the default, and this option is obsolete.
- --tif-compress <None|LZW|Deflate|Packbits (default: LZW)>
TIFF compression method.
- --cog
Write a cloud-optimized GeoTIFF (COG). See Section 6.2.7.
- -v, --version
Display the version of software.
- -h, --help
Display this help message.