3

I'm trying to get a better understanding of the limitations of world files and how I can use them in a current project.

If I produce an ESRI world file (tfw) with listgeo:

listgeo -tfw clip.tif

Then downsample the image with ImageMagick and use in geotifcp:

geotifcp -e clip.tfw output.tif final.tif

Will the georeferencing be accurate on the downsampled image? If not, how do I address this situation?

  • 2
    Is there any particular reason you use imagemagick (i.e a specific resampling algorithm) instead of using GDAL directly to downsample? The georeferencing would then be handled by GDAL during the resampling and you wouldn't have to worry about messing around with world files... – user2856 Sep 8 '17 at 3:07
  • I have a lot of files to handle and TONS of downsampling. I'm thinking that compiling imagemagick with OpenCL support and running the downsampling on GPU's would speed things up by a significant factor. – Steven Lutz Sep 8 '17 at 8:37
  • I suspect the extra effort you'll make to handle the scale will take longer to debug than you'll save. GDAL is pretty fast, and it's absolutely solid for working with complete metadata. – mdsumner Sep 10 '17 at 10:42
  • I have massive amount of data with lots of down sampling to do... and will need to do with many projects moving forward. – Steven Lutz Sep 10 '17 at 15:15
4

The six lines in the .tfw file describe:

  1. pixel size in the x-direction in map units/pixel
  2. rotation about y-axis
  3. rotation about x-axis
  4. pixel size in the y-direction in map units, almost always negative
  5. x-coordinate of the center of the upper left pixel
  6. y-coordinate of the center of the upper left pixel

If you are just downsampling the image, you aren't changing the rotation (2 & 3).

You are changing the pixel size (1 & 4), so you'll need to manipulate these values. If you downsample the image to half of its original size, each pixel will cover twice the area so you'll have to double this value.

Since the pixel size has changed, the center of the top-left pixel is also going to move, so you'll need to modify 5 & 6 by the appropriate amount. If you downsample by a factor of X in the direction of pixel size P (lines 1 & 4), you'll need to increase/decrease those values by (X-1)/2 * P.

So for example, you have the following world file and you downsample the image by 2:

10
0
0
-10
10000
20000

The new world file should be:

20
0
0
-20
10005
19995
  • Thank you for your response. it's very helpful, however I'm unsure of how to calculate the correct coordinates for 5 & 6. – Steven Lutz Sep 7 '17 at 21:04
  • 1
    see update for more info – Marc Pfister Sep 7 '17 at 21:22
  • Thank you for your input. i'll be testing this out in the next few days. – Steven Lutz Sep 8 '17 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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