NZ Rail Maps: Using Gimp To Georeference Retrolens Aerial Photos [3]: Getting Imagery Into Gimp

So let’s get this rolling. First thing I need is to download the layers from Linz Data Service. Which in this case is at the following URL:

The layer is called Northland 0.1m Urban Aerial Photos (2014-2015) and covers the stations of Whangarei, Portland and Kamo. It also covers the port area of Whangarei, which is good, because the NZR station surveys cover all the extra bits. I chose to download the entire layer, which is 4.8 GB. I find it preferable to use a download manager when handling downloads of this size. Since I use the Firefox Developer Edition browser, the best download manager is uGet. Although a bit fiddly to set up, it works well, especially since I have my computer set up to save my profile whenever I need to reinstall the operating system.
I’ll also note where I get the NZR survey images from. I’ll go to the Retrolens site and zoom it in on the Whangarei rail yards. Just typing in “Whangarei” and zooming in on that word on the Retrolens interface is enough in this case, because it conveniently brings us right to the railway station. Often though this is not the case and you’ll find Retrolens thinks the centre of an area is way out in the countryside in the case of smaller townships and localities. It pays basically to have a look at another map, find a street name close to the railway station, and put that into Retrolens to make it easier to find the exact part of the map that I want to look up the aerial photos for.
The NZR survey is No.2788, with six different runs, from A to F, covering all the way down from Kamo to the Whangarei Port, and all of it was captured in 1975 at a scale of 1:4325. If I start from the rail yard area, on the right hand side of the Retrolens web site, I can see the aerial photos for an area, and I’ll be looking for the ones that have a date of 5/01/1975. Clicking on one of these (I only need one of them at the moment, and it doesn’t matter which one) will come up with more details, at which time I can confirm the survey number SN2788, the run number and photo number (the run number is going to be between A and F in this case but it doesn’t really matter that much) and the scale is 4325. This scale in particular, or 4350, is virtually a unique signature of the NZR station surveys that can help you to identify them on sight, but in case you are unsure, view the labels in the margin to see if it says “NZR” or “RAIL” anywhere. Some of the aerials I have downloaded around Auckland and Wellington of the rail yards there are an even larger scale than 4325 or 4350.
Now here’s a couple of little tricks to download all the images I need from this survey. First of all I’ll click the Large button and bring up this image in the Large size, which is the highest resolution I can download from Retrolens. Now in this case the URL of this image is as below (so you can save yourself a bit of work by just skipping the above steps and going straight to this web page:
Now, the fact is all NZR surveys start at Run A and photo 1. So I could go through the Retrolens site to find every single one of the images and get them. Or I could just change the letter D in the above URL in the address bar on the browser to the letter A and the number 3 to the number 1 and then press enter with the new URL to get 2788 A 1. And that is exactly what I do. This is a much faster way of downloading all the images from Retrolens. And when I hit a 404 error at the end of run A, I can start with run B photo 1, knowing in this case they go up to run F.
The other trick is usually you won’t need every image from the survey, because they overlap enough that in 99.9% of cases with an NZR station or corridor survey, there is so much overlap that you only need to use every second image. Generally, I download every image, and then decide which ones to import into Gimp, which may be A 1, A 3, etc but sometimes it can be A 2, A 4 etc. Obviously choosing to use all the images just makes a lot more work for you in Gimp, but it also is going to increase significantly the amount of data that is stored in the file and make it bigger than it needs to be. 
The amount of disk space I have used to create mosaics is such a challenge for me to manage that I am sooner or later going to have to implement an economising strategy of actually deleting project files, simply because I can recreate them quickly in future with the extracted mosaic tiles, at the cost of a small loss of quality. At the moment my computer has more than 1.5 TB of Gimp mosaic originals stored on it, and I have decided I am simply not going to upgrade it to 4 TB disks, so managing the use of the 2 TB disks is what I am actually doing in practice. The extracted mosaic tiles in Jpeg format use much less space than Gimp does. That’s understandable because the Jpeg format is lossy one-way compression, whereas Gimp is using lossless two-way compression that can recover all of the original data. If Gimp had some way of saving an archive copy of a project so that it was lossy compressed that would save a lot of disk space, and since that isn’t practicable, the alternative is to split the files into lossy extracted mosaic tiles, which save a lot of disk space, and delete the project files. So far I haven’t deleted any project files but it’s inevitable I will have to do this sooner or later.
Anyway back to the maps. So we want to lay out our background tiles downloaded from LDS in the Gimp canvas. First thing is to set up the Gimp grid to 4800 pixels wide x 7200 pixels high. Next thing is to view the grid, and then turn on Snap to Grid. Then with a blank canvas, or no canvas because it will create one if there is nothing open, use Open as Layers to load the layers JPEG files from LDS. If you want them to appear in the “correct” order in the layer list, set the filename sort order in the dialog to Filename descending, this is because of the order Gimp adds the filenames to the layer list. They will all be displayed stacked on top of each other in the middle of the canvas and each one will be a separate layer. 
Then you need to increase the size of the canvas, to a multiple of 4800 pixels width and a multiple of 7200 pixels high. Once you have that, then start dragging the tiles into their place in the grid. Select the first layer in the list (right at the top) and then drag them one at a time. This is where Snap to Grid comes in handy. The filenames are based on a column reference followed by a row reference. The filenames use the digits 0 to 9 in sequence, followed by capital letters, then increment the next column of digits and back to 0 again. E.g. 50, 59, 5B, 5Z, 60 etc. But Gimp’s filename dialog gets this order wrong for some reason (at least in Linux it does). There are a small number of letters missing from filenames, notably the five vowels. The tiles are usually all 4800×7200 wide, which is why I set up the grid to these settings. It pays to download a bigger area than you actually need, because LDS has this nasty habit of serving you fractional tiles around the edges of your crop area, which can be tricky to work with.
Next step: load the Retrolens images using the same Open as Layers command. They will also be stacked in the middle of the canvas. You don’t need to do anything with them just yet so don’t drag them anywhere as the next step (which will be in the next post) is most conveniently done to all of them whilst they are still stacked together. Right now is probably a great time to save your Gimp project. Have a cup of tea or a coffee and then start reading Part 4 of this blog series. Here we’ll actually prepare the images and start overlaying them.