Sunday 22 April 2018

Otago Central Railway [61L]: Cromwell-Alexandra 9

So I am doing the tile merges in Gimp to fix up the tiles that are in two pieces with overlapping black borders so that I can use the latest and greatest quality Linz aerial photography of the entire line. This requires a number of different steps, these are as follows:
  1. Find two overlapping tiles in Qgis
  2. Line up the tile images in Gimp
  3. Add a mask to one of the images
  4. Use the Gimp select by colour function to select the black border on the masked image
  5. Edit the mask by filling in the selected area with black, this makes it transparent
  6. Line up the images so they overlap properly
  7. Merge the two layers so that the resulting layer is 4800x7200 pixels. It may be necessary to undo and realign if the result is slightly too tall or short.
  8. The next step after Gimping the tiles is to fix the .jgw world file for the merged layer. This involves combining values from the overlapped layers' .jgw files and probably also using the adjacent tiles' .jgw files for guidance. I have to find out just what the format of this file is to ensure I can put the right values into it.
  9. Once all the tiles are merged and aligned on the canvas I follow the usual procedure to export each merged tile to a new file. Then rename its sidecars to match.
  10. An optional final step to look at is re-rendering the historical layers over the 0.4 metre aerial imagery (they were originally done using the 0.75 metre imagery before I worked out how to fix the overlap issues with the 0.4 metre tiles). Since the different tiles don't magically line up, it will be a case of visual realignment between the 0.75 metre and 0.4 metre tiles in the same way as was used to line up the historical layers to the 0.75 metre aerials. Hopefully this will turn out to be a fairly routine step but I have left myself with an out of just putting the 0.75 metre tiles where used over the top of the 0.4 metre tiles if it gets too time consuming because fixing all the issues with the aerial photos for this section of the route has taken a lot more time and effort than originally expected.
Here is an example of what is completed so far in Gimp:

As can be seen here the overlap of the older (lighter) and newer (darker) imagery is on an angle rather than a straight line, for reasons best known to Linz. If you were to zoom in on the overlap boundary you would discover some bits of black still in there because removing all of these is not possible and I am finding even with some of the contiguous stuff I have downloaded there are small overlap gaps between adjacent tiles so the imagery is not perfectly aligned all of the time. It is, however, much better than Google Earth in this respect and I can tolerate these small errors as such.