Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'd like to use gdaltindex to create a polygon shapefile of thousands of georeferenced .tif documents. I've found this incredibly easy to accomplish in a single directory on Linux (e.g. gdaltindex indexoutput.shp *.tif) but I'll also need to index several hundred sub directories on a windows drive. I do have FWTools installed on the windows machine.

The majority of these files are Tiff's with a world file and have not yet been converted to geoTiffs. I work in a few different coordinate systems, so ideally I'd like to go through and make a single pass at each coordinate system.

It looks like I can use -skip_different_projection to take care of the projection issue, but my search hasn't turned up any parameters of gdaltindex to specify directories, so any help is much appreciated.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

You can use an optfile (see the bottom of the page) which contains paths to all your tif files.

You can create the optfile using a dos command prompt - something like:

dir /s/b *.tif > tiff_list.txt

You can then just call gdaltindex with the optfile:

gdaltindex -skip_different_projection indexoutput.shp --optfile tiff_list.txt

As for the different projections, if you know what projectios everything is in you can use a different optfile. Otherwise you could potentially do the following (bit sloppy I know, but I can't think of a way you could do it otherwise):

  1. run through the optfile
  2. compare the resulting index with the optfile, remove any duplicates from the optfile
  3. rinse and repeat until there are not tif files left to be cataloged
share|improve this answer
    
Thanks, that's a good idea. I'll give it a go in the morning. I use 2 or 3 different projections. I'm wondering if I could create an empty shapefile for each projection & then run the command with the -skip_different_projection command and the opt file. I'll try and post my results. –  Paul May 4 '11 at 1:14
    
I had good luck creating the opt file and using it as a parameter. My problem now is that gdaltindex only recognized my geotiff files as having a spatial reference, and skipped all of the other tiff files with world files. I'm going to try converting all of these to geotiffs and then running the command again. –  Paul May 6 '11 at 23:17
    
Glad to hear the optfile is working. Rather than converting to geotiffs, maybe try virtual datasets (gdal.org/gdal_vrttut.html), as that would save some disk space. –  om_henners May 7 '11 at 6:23
    
Thanks again. These .vrt files seem like another great tip, although I only had time for a quick read of the documentation today. I'll spend some time with this tomorrow after I've taken care of the Mother's Day duties. –  Paul May 8 '11 at 16:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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