[gdal-dev] gdallocationinfo.exe multiple access

Even Rouault even.rouault at spatialys.com
Sat Feb 28 09:05:32 PST 2015


Le samedi 28 février 2015 17:51:47, Yuta Sato a écrit :
> I have a list of longitudes and latitudes for which I extract the pixel
> values using gdallocationinfo.exe one by one for each pairs of longitudes
> and latitudes using for loop.
> 
> How I simultaneously get pixel values for all the list of longitudes and
> latitudes?
> My list is large, so I want faster retrieval.
> I am using python and outputting the pixel values into text file.
> Is it possible?

Yuka,

you can pipe into gdallocationinfo several tuples of coordinates:

$ printf "0 0\n0 1\n" | gdallocationinfo byte.tif
Report:
  Location: (0P,0L)
  Band 1:
    Value: 107
Report:
  Location: (0P,1L)
  Band 1:
    Value: 115

But I think it would be easier/faster to just do that fully in Python. The 
following script has likely everything you need to do that:

http://svn.osgeo.org/gdal/trunk/gdal/swig/python/samples/val_at_coord.py

Even


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list