I recommend using Python or R (or a GIS software), as @Marc Pfister has suggested.
However, you can do it with bash and gdal only, and heavy usage of
First get the Min/Max values without coordinates:
Obtain the Min / Max values with
gdalinfo -mm like explained in your other question about Min/Max values. Use
grep (and possibly some
awk) to extract the values.
Get their corresponding coordinates:
Convert your tiff file to xyz using
gdal_translate. (Beware, large file size ahead!)
gdal_translate -of XYZ input.tiff /tmp/output.xyz
grep for the Minimum or the Maximum value. For example, if your Maximum value is 2878, type
cat /tmp/output.xyz | grep -E ' 2878$'
to get the corresponding Lat / Lon / Elevation output:
36.2358333333333249 -0.123611111111111116 2878
If you are working with a float dataset, you should adapt the grep expression in order to find rounded Min/Max values.
Alternative if you got the pixel row/column coordinates with other software:
If you don't like the xyz file method, you could also first get the pixel row/column coordinates of the Min/Max values and then convert them to the corresponding lat/lon pair with
For example, if you found out that the maximum value is at pixel coordinates x=12 y=300:
echo 12 300 | gdaltransform image.tif will output the corresponding geo coordinate pair depending on the CRS of your source image:
36.2358333333333249 -0.123611111111111116 0
If you keep this final coordinate conversion as an extra step, you may be able to use some other software packages (without geospatial features) (e.g. imagemagick) or a small Python / R script to locate pixel coordinates of the the Min/Max values in a more efficient way.