[gdal-dev] RFC 32 - gdallocationinfo utility

Frank Warmerdam warmerdam at pobox.com
Mon Nov 1 14:47:21 EDT 2010


Eli Adam wrote:
> Frank,
> 
>      This is a helpful new utility.  
> 
> I read the documentation and tried it out.  Using gdallocationinfo to find the elevation at a given lat/long location seems like a reasonable use.  It may be desirable to input and output an ogr layer rather than a single point.  For instance, what are the elevations at these points in this shapefile?  
> 
> I tried to approach that problem by putting the coordinates into a file with ogrinfo and then use that file as an --optfile for the x y.  That didn't work the way that I tried it.  Can an --optfile be used for the x y input?  
> 
> ogrinfo town.shp town | grep 'POINT' | sed 's/  POINT (//' | sed 's/)//' > xyinput2.txt
> 
> head xyinput2.txt 
> 7350538.701077490113676 371057.403368594241329
> 7388905.153187953867018 357147.769300847954582
> 7346377.449287764728069 409114.138115067325998
> 
> gdallocationinfo -s_srs "EPSG:2913" townraster.tif --optfile xyinput2.txt 
> Usage: gdallocationinfo [--help-general] [-xml] [-lifonly] [-valonly]
>                         [-b band]* [-s_srs srs_def] [-geoloc] [-wgs84]
>                         srcfile x y
> 
> What would be the proper approach to the above hypothetical problem?  Is there an effective way to have an ogr input for gdallocaitoninfo?  Perhaps -input_file_list my_liste.txt for the x y similar to gdalbuildvrt?

Eli,

As currently implemented gdallocationinfo only accepts one location on
the commandline.  The --optfile expansion is presumably working but
you can't give more than one xy pair on the commandline.


> It looks like -s_srs applies to the x y input.  -s_srs sometimes, i.e. gdalwarp, applies to the srcfile.  

I gather you are suggesting the parameter name is confusing?   It might
make sense for me to call it -l_srs (location srs).  I'll make that
change.

> Is -wgs84 equivalent to -s_srs "EPSG:4326"?

Yes - it's just a shortcut for a common case.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list