Given a topographic raster image.

Given a pixel's coordinate in pixel/lines or geocoordinate.

How to get it's pixel value ?


1 Answer 1


1. Get the pixels value: gdal's gdallocationinfo allow to access a pixel's value.

The gdallocationinfo utility provide a mechanism to query information about a pixel given it's location in one of a variety of coordinate systems. Several reporting options are provided.

$ gdallocationinfo crop.tif 50 50
  Location: (50px,50line)
  Band 1:
    Value: 73

To only get the value :

$ gdallocationinfo crop.tif 50 50 -valonly
> 73

Depending on geocoordinate:

$ gdallocationinfo crop.tif -geoloc 0.00 44.00
> 132

Afterwhat you may want to 1. iterate all pixels and 2. apply conditional filter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.