Category: NZTekonverse -> Scripting

  • Python Scripting [6C]: Layer Sidecar Duplication & Renaming for NZ Rail Maps 3

    After the use of the duplicate.py script for a while, an amendment has been decided upon and implemented this week. This is to simply duplicate the sidecars where there is no change of pixel size involved.  For example it may be just a case of the prefix being changed. To implement these changes the following…

  • Python Scripting [6B]: Layer Sidecar Duplication & Renaming for NZ Rail Maps 2

    Since yesterday the script has been completed and tested OK. Here is the complete script. It is similar to the segments script but a lot less complex with a total of 77 lines.  # declarations import glob import argparse import os import shutil import sys rootPath = os.getcwd() # set up command line argument parser…

  • Python Scripting [6A]: Layer Sidecar Duplication & Renaming for NZ Rail Maps 1

    Our new scripting project as of present is a script called duplicate.py which is specifically with the NZ Rail Maps project and it aims to achieve duplication and renaming of the sidecar files that are associated with raster layers. Suppose that we have a base raster 4800×7200 pixels named in the following pattern: Timbuctoo-930W8-92NN9.jpg We…

  • NZ Rail Maps: Optimising Gimp and using 4x4x4 grid for mosaics [3]

    Since last writing on this subject I have further determined that I can scale 0.3 and 0.4 metre pixel resolution background Linz aerial images to double the scale (0.15 and 0.2 metres) and these scales work very well with the 1:4300/4325, 1:5500 and 1:8000 scale Retrolens aerial photos which are the best ones for creating…

  • Python Scripting [4B]: Exif Based Image Renaming 2

    Today I am going to have a look at Pillow and its interface for reading EXIF data from images. As I mentioned previously, Pillow is a fork of PIL (the Python Imaging Library) and contains capabilities to read and write EXIF data from images. Although there are official documents for Pillow at Readthedocs, it is…

  • Python Scripting [4A]: Exif Based Image Renaming

    This is now a new scripting project I am starting for Python. I need this script to rename all my photos off the camera, replacing the use of IrfanView which I used on my Windows 10 computer. Whilst I still have that computer and the software, I am looking to do something with Python scripting…

  • Python Scripting [3F]: Layer Fractional Segments for NZ Rail Maps 6

    Today’s little bit of fun and games has been to change the script so that it can read in a list file and process a list of source layers and produce the world and auxiliary files for them. Last night I discovered there was some additional aerial photos available for OtiraNorth area, for which I…

  • Python Scripting [3E]: Layer Fractional Segments for NZ Rail Maps 5

    I made a lot of progress on this on Wednesday, mainly due to dropping nearly everything else and pushing on to finish it. After testing it, which so far has worked well, I decided to add an extra step to the workflow. The source layer (base layer) is a jpg file and we are making…

  • Python Scripting [3D]: Layer Fractional Segments for NZ Rail Maps 4

    Continuing from our last post, we now want to find tile segments that need world files written for them and generate those files.  The code to do this (from the steps outlined previously is: Strip the extension off the base file (92XJ7-92MKF.jgw) so that we get 92XJ7-92MKF: baseNameBase = os.path.splitext(baseName)[0] Split the filename at the…

  • Python Scripting [3C]: Layer Fractional Segments for NZ Rail Maps 3

    Last time we had a look at how to read data from our files and store it in a list. This time we are going to get that data and perform the calculations we need on it. First thing is to convert the numbers read out as strings to floats. The numbers we need are…