General, Python

Locating Python 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

Advertisements
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. This series of blog posts describes my development environment from high level technologies down to the specific apps I use every day. 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.enable_load_extension(True)

	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