<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>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.</div><div><div>Do be able to accomplish this, I wrote</div><div>1. gdalinfo_11.sh</div><div>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</div><div>2. xy2file_28.c</div><div>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.</div><div><div><font class="Apple-style-span" face="Courier"> /usr/bin/time ./xy2file_28 ${HOME}/gis/text_for_dcua/xy_coor_11.txt 294898 4313543</font></div><div><font class="Apple-style-span" face="Courier"> inx=294898.000000 iny=4313543.000000 </font></div><div><font class="Apple-style-span" face="Courier"> Checking 0 100 200 300 </font></div><div><font class="Apple-style-span" face="Courier"> inx= 294898.0000 iny= 4313543.0000 is within </font></div><div><font class="Apple-style-span" face="Courier"> ulx= 294000.0000 lrx= 295500.0000 uly= 4314000.0000 lry= 4312500.0000 of </font></div><div><font class="Apple-style-span" face="Courier"> 18stj940125.jp2 </font></div><div><font class="Apple-style-span" face="Courier"> Resuming checking 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1699 </font></div><div><font class="Apple-style-span" face="Courier"> 0.01 real 0.00 user 0.00 sys</font></div></div><div><br></div><div>This script and this program can be downloaded from <a href="http://homepage.mac.com/gregcoats/jp2/xy2file.zip">http://homepage.mac.com/gregcoats/jp2/xy2file.zip</a></div><div>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.</div><div>Greg</div></div></body></html>