User Tools

Site Tools



NSWTopo is a Ruby program developed by Matt Hollingworth for generating detailed topographic maps for NSW and ACT. There are good instructions on installing and using the program at the link above, though it requires the installation of several pieces software, and uses a command line interface, so is not for the novice.

The program is largely tested in MacOS/Linux.

Version 2.0.0 worked under Windows. Version 3.1.0 was released recently (Sep 2023), but there appear to be some issues with getting it to run under Windows.

I've listed the issues I hit below under the Windows heading - the last of which I think would need code changes. Unfortunately I'm a Ruby novice, so not sure how to resolve them.

Instead, I ended up installing Windows Subsystem for Linux (WSL), which allows you to use Linux directly on a Windows machine. This was successful, though not without some challenges. Instructions are below.


List of issues for installing NSWTopo 3.1.0 on Windows, and how I resolved them (until the last)

1. Wrong version of nswtopo

If you have previously installed Ruby and run nswtopo, you will probably have an old version of both on the system. My recommendation would just be to uninstall these. I spent a while trying to get them playing nicely together, but failed. You may have more luck, but you may also just waste time.

You can check which version is running by default by running: nswtopo -v

2. Running nswtopo reports "no layers installed"

Not sure what the root cause of this is. It was working previously in version 2.0.0. The documentation suggests that it should work by default. The main thing that has changed for me is that Windows is installing the gems under %USERPROFILE%\.gem\

I ended up just adding the config using:

nswtopo config --layer-dir "C:\Users\brennant\.gem\ruby\3.1.0\gems\nswtopo-layers-1.0.0\layers"

(or whereever your layers have been installed to)

3. ERROR 6 when running

For some layers, I was getting “ogr2ogr: ERROR 6: Backward Seek() unsupported on /vsistdin beyond maximum buffer limit (1048576 bytes).”. The root cause seems to be that large layers exceed the buffer size. The solution is to increase the memory.

In %USERPROFILE%\.gdal, create blank file called gdalrc (no suffix) and add the following lines:


You can set the memory to larger numbers if desired, but I imagine 1GB should be sufficient for most purposes.

4. Chrome version check fails

Chrome under Windows doesn't have a –version parameter! This impacts the version checking carried out in chrome.rb.

I ended up hacking the code to simply comment this out.

#        stdout, status = Open3.capture2 path, "--version"
#        raise Error, "couldn't start chrome 1" unless status.success?
#        version = /(?<major>\d+)(?:\.\d+)*/.match stdout
#        raise Error, "couldn't start chrome 2" unless version
#        raise Error, "chrome version #{MIN_VERSION} or higher required" if version[:major].to_i < MIN_VERSION

5. Chrome issue when rendering

At this point, the program was downloading data and generating a zip file of layers. However, when it came to running the render process, I hit another Chrome issue:

C:/Users/brennant/.gem/ruby/3.1.0/gems/nswtopo-3.1/lib/nswtopo/chrome.rb:121:in `spawn': wrong file descriptor (3) (ArgumentError)

My guess is that this error is also related to Chrome on Windows, but I don't have the skills to debug.

At this point I gave up and started installing WSL (below).

Linux (using Windows Subsystem for Linux)

Install WSL

Open a command prompt (probably an administrator one) and run: wsl –install

Use the default (Ubuntu) installation unless you know what you are doing.

You will need to set a user/password and reboot to finish the installation.

After rebooting, start Ubuntu (under Apps in the Start Menu). Then you'll need to start installing software. Start by getting all the existing packages up to date:

sudo apt update

Install Google Chrome

Install GDAL

Install Ruby

The default ruby installable via apt is currently (Nov 2023) < 3.1, which is required for version 3. Snap is an alternate package manager.

sudo snap install ruby –classic

It is probably better long term to install Ruby using a Ruby manager like rvm or rbenv, but these require a bit of extra knowledge/work to install. See for more info

Mount data drive (optional)

If you have your data on a Windows drive (mine is on drive E:) you can set this up for access here:

sudo mount -t drvfs E: /mnt/e

Install NSWTopo

After all this, there are still a few little hurdles to jump! You can install nswtopo and nswtopo-layers using gem.

gem install nswtopo

gem install nswtopo-layers

If you have previously installed nswtopo on your Windows machine, there will likely be copies of it somewhere in your path - which is also used as the starting point for the Ubuntu path. I wasted a lot of time - unsuccessfully - trying to resolve this. In the end, I just ran the Ubuntu version of nswtopo using the full path (in my case /home/tomb/.gem/gems/nswtopo-3.1.1/bin/nswtopo rather than nswtopo). A bit painful. There may be easier ways around this.

Confirm NSWTopo version

Run nswtopo -v (or nswtopo –version) to see whether you have version 3.1.1 set. If not, or you get an error, you will probably need the full path.

Check layers

Check whether the layers are enabled by running:

nswtopo layers (you may need the full path to nswtopo)

My layers originally weren't, due to some dependency issues - but later fixed. I manually enabled the layers via the config:

/home/tomb/.gem/gems/nswtopo-3.1.1/bin/nswtopo config –layer-dir /home/tomb/.gem/gems/nswtopo-layers-1.0.1/layers

You'll need to do something similar if you've manually downloaded nswtopo-layers.

Test installation

Finally we are ready to rock!! Select a smallish bounding area (or a non-urban area) - you can use, selecting a rectangle, and using the KML download. Create a directory, drop the renamed bounds.kml into it, and navigate there:

/home/tomb/.gem/gems/nswtopo-3.1.1/bin/nswtopo init –bounds bounds.kml map.tgz

/home/tomb/.gem/gems/nswtopo-3.1.1/bin/nswtopo add map.tgz nsw/topographic

/home/tomb/.gem/gems/nswtopo-3.1.1/bin/nswtopo render map.tgz map.svg map.tif

nswtopo.txt · Last modified: 2023/11/22 15:42 by bushwalking

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki