Continuing from the previous post in this series. Once you have made up some mosaic tiles you need to know how to edit the sidecar files. In this case with the map tiles that come from LDS there are three sidecar files alongside the actual image. We only need to concern ourselves here with the .jgw file:
- jgw file: this is called the World File and contains six lines of text. The values of these in order are:
- Line 1: A: x-component of the pixel width (x-scale)
- Line 2: D: y-component of the pixel width (y-skew)
- Line 3: B: x-component of the pixel height (x-skew)
- Line 4: E: y-component of the pixel height (y-scale), typically negative
- Line 5: C: x-coordinate of the center of the upper left pixel
- Line 6: F: y-coordinate of the center of the upper left pixel
- If we have tiles that are double the resolution in both directions but otherwise identical we just need to change the first four to match the pixel size.
- In this case the world file for the upper-left most tile out of the four we have in the file contains the following values:
- 0.400000000000000
- 0.000000000000000
- 0.000000000000000
- -0.400000000000000
- 18835200.199999999254942
- -5627520.200000000186265
- We just need to change the first line to 0.2 and the 4th line to -0.2 to say that each pixel is half its previous size.
When you open that tile as a raster in Qgis it looks for all the sidecar files. The other two files amongst other things will tell it the CRS (EPSG:3857 is the one I use for all NZ Rail Maps as it is compatible with Google Earth KML files) which it needs to know in order to interpret the world file coordinates etc. The files all need to be renamed to the same file name part but leaving the extensions correctly and they do need extensions because Qgis is multi platform so the extensions are required by the Windows versions (even though in theory they could read the magic numbers from the file headers the way Linux and MacOS do). So I use Thunar’s bulk renamer to rename groups of files and I have installed it under KDE (it is part of XFCE but will work under KDE no problems).
Well it came together exactly as planned with perfectly aligned tiles so that is the technique I will be using to do a lot more maps whenever necessary if I need to make best use of higher quality scan imagery.