I have a folder which contains a large number of files in GeoTIFF format. I need to generate both PRJ and TFW files for each of these images. Is there some slick way of doing this?
Thanks!
Joe
|
I have a folder which contains a large number of files in GeoTIFF format. I need to generate both PRJ and TFW files for each of these images. Is there some slick way of doing this? Thanks! Joe |
|||
|
|
|
The slickest way to generate TFWs is to write a script in Python or Java using GDAL, which would be a handful of lines of code. Creation of old-style (pre ArcGis 9) .prj files are not supported GDAL, only reading (see here). New-style (based on WKT) files are supported for creation, but it's not guaranteed they cover all cases. But either way, in a supreme case of displacement activity, I have written a Python script that does what you need. There's no error checking or anything, but it works for the directory of tiffs I had to hand, YMMV.
Call it from the command line like this:
The second parameter can be prj to generate WKT-style prj files, or anything else to just generate .TFWs. If you can't use Python scripts for whatever reason, you can use:
But that will copy the image data too, so you'll have to delete the original. And of course, it won't generate .prj files of either flavour. But presuming all your tiffs are in the same projection, you could just hand-craft a .prj file and duplicate it for all the source images. |
|||
|
|
|
The For example, I have a directory of GeoTIFFs, and I have libgeotiff installed as part of OSGeo4w. You can run the OSGeo4w shell, and do this:
It would be nice if the same utility could also extract the PRJ file too. |
|||
|
|
|
Not really - if you know the projection of the files then you can look up the content of the prj file at http://spatialreference.org and then use a shell script to copy a template to each a .prj file for each image. Georeferencing them will need to be done on a per image basis as the .tfw file will be different for each image (unless they are all of the same place). http://warper.geothings.net/ may be the way to go if you don't have access to a desktop GIS to do this in. |
|||||||||||||
|