General, Python, Tutorial

Five signs your spreadsheet might smell (and what you can do about it)

In the world of software development, a code smell is a readily identified surface indication that often corresponds to a deeper problem in a system. Code smells are not bugs but can reveal a codebase that is fragile or may be difficult to maintain in the long term. With a little bit of practice code smells (which have entertaining names like “feature envy” and “shotgun surgery”) are generally easy to spot but understanding how to fix smelly code can take a lot of knowledge and experience.

Spreadsheets, on the other hand, can be an incredibly powerful tool for quickly testing concepts, analysing data and visualising outputs, but their ubiquity and apparent ease of use often means they get taken beyond their point of efficiency. The following “spreadsheet smells” are intended to help you quickly identify when things might be getting out of control and present a few possible solutions … continue reading

General, Python

Locating Python 2 for ArcGIS desktop and adding it to your system Path

Now updated for Windows 10!

To access the Python interpreter and run Python scripts you need to know the location of python.exe for the installation you wish to use. To make running scripts easier you may wish to add this location to your system Path, either temporarily or permanently. This post describes how to do each of these as well as some general considerations.

Continue reading

Arcpy, GDAL/OGR, General, JavaScript, Python, Tutorial

My Windows Dev Stack

As a researcher I often develop for Python, JavaScript (both Node.js and browser) and HTML/CSS on Windows. Check out the Windows Dev Stack repository which outlines the specific apps I use on a daily basis. It should be of interest to anyone doing Python or web development – hopefully you pick up some new ideas, useful apps or different ways of doing things!

Continue reading

Python, Spatialite

Python and Spatialite (32-bit) on 64-bit Windows

For some reason it is insanely difficult to use Spatialite from Python on Windows. In theory the following should create and connect to an in-memory database, then load the Spatialite extension (after mod_spatialite and friends have been put somewhere and added to your system Path):

import sqlite3

with sqlite3.connect(':memory:') as conn:


	conn.execute("SELECT load_extension('mod_spatialite')")

However, this fails stating: OperationalError: The specified module could not be found.

Continue reading

JavaScript, PostGIS, Python

A simple CherryPy RESTful JSON server

I have recently been working with CherryPy. Although it seems very powerful, it is quite hard to find simple and clear online examples for some things. In this case I wanted to set up a RESTful server that can accept POST requests containing JSON/GeoJSON, and return JSON/GeoJSON. For testing I set up a small web page that sends the request and displays the response. Continue reading

ArcGIS, General, Python

Enable Python installations that were not installed by ArcGIS to access Arcpy functionality

ArcGIS installs its own version of Python that is not officially registered with the system but can in reality be used just like a normal install. I personally prefer just to use this as my primary Python, but it is not always possible. The instructions below can help you let a different Python install access and use Arcpy Continue reading