Category: NZTekonverse -> Scripting

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

    Yesterday we looked at how to collect command line parameters easily in a Python script. Today we need to turn the parameters into filenames and then read their contents to memory. First thing is to get the arguments into variables we can refer to and manipulate. This is pretty simple as the arguments are stored…

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

    This is a technical description of the scripting project which is for dividing a large layer into segments for NZ Rail Maps. As discussed in some previous posts I am taking for example a 0.4 metre resolution tile and scaling it to 0.1 metre resolution making it 16 times the area of the original. Then…

  • Python Scripting: Planned Scripting Projects

    I’ve written a few posts about different scripts I am planning to look at. At the moment the ones that are most important are: A script to do segmented layer fractions for NZ Rail Maps. I am doing this very slowly and laboriously with a spreadsheet and keep making mistakes and having to paste things…

  • NZ Rail Maps: Scaling up map mosaics & creating new tile grids

    One of the issues that comes up with doing the map mosaics for NZ Rail Maps is that the resolution of Retrolens aerial imagery can often be very high, when using the official NZR survey images at the scale that they appear on Retrolens. A typical scale is only 1:4300 which gives us a lot…

  • Python Scripting [2A]; Syncing a video and music directory tree

    Having completed our first scripting task involved XML extraction and copying files, the next task to be scripted in Python will be the process of extracting audio from our collection of music video tracks and syncing it into a directory tree. The actual steps needed are: Compare two directory tree, one for video and one…

  • Python Scripting [1C]: Scripting to copy map aerial layers 3

    So I spent a bit more time completing the script, which now looks like this: import glob import os import shutil import xml.etree.ElementTree as ET tree = ET.parse(‘/home/patrick/Sources/CopyFiles/Source/layers.qlr’) root = tree.getroot() for layer in root.iter(‘layer-tree-layer’):         sourcename = layer.get(‘name’)         print(“Layer: ” + sourcename)         sourcepath = “/home/patrick/Sources/CopyFiles/Source/” + sourcename + “.*”         #print(fpath)        …

  • Python Scripting [1B]: Scripting to copy map aerial layers 2

    So as I said at the end of the last post, I am learning to script in Python. Which is turning out to be breathtakingly simple and easy to do. I remember that I was going to do this script originally in Python then ended up doing it in Powershell. Why I did that at…

  • Python Scripting [1A]: Scripting to copy map aerial layers 1

    In my arsenal of computers I have one low spec one that still runs Windows. Even with all the stuff I have for Linux, there are still a handful of tasks that use Windows only software, although this has diminished to the point that this computer often doesn’t get turned on for weeks at a…

  • New bits for “old” computers [7]

    The serverpc is now being used to store additional mapping resources, specifically aerial photos as the amount of space these take up is significant and at times has filled up a lot of disk space on mainpc. I am working on a new layout of my keyboards so that I can use both computers at…