[GIS] Topography: How to get the x,y,z coordinates of highest or lowest point/pixel of a raster GIS

gdalgeotiff-tiffrasterraster-calculatortopography

Given a .tiff topographic raster image with mountains and deep sea, I am looking for the x,y,z specifics of the highest or lowest point.

The x,y,z values being:

  • altitude (z-coordinate)
  • latitude (y-coordinate)
  • longitude (x-coordinate)

While gdalinfo raster.tif would give a summary of the bounding box and the highest / lowest elevation values (see my previous question here, and note comments below), I would like to find the elevation, latitude, longitude of the highest and/or lowest pixels of my raster.

Would be better if these values are got as isolated output integer. I think raster processing iterating on all pixels of the raster and keeping values of the z-highest point may be a good way to go.

Best Answer

Is Python an option?

Use RasterIO (a Python GDAL/ numpy bridge) to load the raster to NumPy array, then use numpy.amax() to find the maximum value, followed by numpy.where() to find the row/column indices, then calculate the lat and lon from the raster extents.