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

A simple CherryPy RESTful JSON server

I have recently been working with CherryPy. It seems really cool, but 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, with the request coming from JavaScript in a web page (no jQuery). 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