[gdal-dev] A way to determine which ONE image in a .vrt is currently being displayed

Greg Coats gregcoats at mac.com
Mon Oct 4 15:43:48 EDT 2010

Using GDAL and QGIS, I am able to pan and zoom through 1699 highly compressed GeoJP2 images, that are seamlessly joined together by a .vrt file. After zooming in to narrowing the area of interest, I then want to know the filename of the highly compressed GeoJP2 image I am currently viewing, so that I can then pull up for that area, a reversible compressed GeoJP2 or a GeoTIFF.
Do be able to accomplish this, I wrote
1. gdalinfo_11.sh
a 25 line bash shell script that extracts from gdalinfo, and writes to a text file, the GeoJP2/GeoTIFF filename, and the Upper Left and Lower Right x,y coordinates
2. xy2file_28.c
a 110 line C program that reads in from the text file created by gdalinfo_11.sh, and the current x,y coordinates displayed by QGIS, and then writes out the filename of the 1 of 1699 georeferenced images that contains those coordinates. Below is a sample output. I note that running xy2file_28 takes only 0.01 seconds.
 /usr/bin/time ./xy2file_28 ${HOME}/gis/text_for_dcua/xy_coor_11.txt 294898 4313543
 inx=294898.000000 iny=4313543.000000 
 Checking 0 100 200 300  
 inx=  294898.0000 iny= 4313543.0000 is within 
 ulx=  294000.0000 lrx=  295500.0000 uly= 4314000.0000 lry= 4312500.0000 of 
 Resuming checking 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1699 
        0.01 real         0.00 user         0.00 sys

This script and this program can be downloaded from http://homepage.mac.com/gregcoats/jp2/xy2file.zip
While these meet my current requirement, they need to be revised and improved to address the wider GDAL audience. I am not qualified to do that, but perhaps someone will more programming and GDAL experience than me will consider doing so.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20101004/a300e426/attachment-0001.html

More information about the gdal-dev mailing list