Manipulating ArcGIS Online services through REST with Python

This week, I faced the problem of having to delete 1.7 million features in a feature service in ArcGIS Online. Normally, I would make a remote connection to the server, access the geodatabase and delete the features with a few mouseclicks. However, ArcGIS Online has no such feature. So I had to resort to the REST interface to the feature service: deleteFeatures. The API reference can be found here. Pretty straightforward, I would say.

But after waiting for a few (or rather: a lot of) seconds, I got a server timeout. It seems that 1.7 million features is rather too much to manipulate through the REST interface. I had to do this in batches. When talking about batches, Python jumps to mind. So I constructed a very small Python script, that also can be used to demonstrate the way you can manipulate ArcGIS Online feature services through the REST interface.

Continue reading


Creating a simple 3D model of the underground with CityEngine

Since the acquisition by Esri, I have been wanting to get my hands dirty with CityEngine. But only recently a good opportunity arose. I was asked to construct a 3D model of the underground for an area in the municipality of Hoogeveen. This also happens to be my last name, so I could this one not let me pass by!

CityEngine is a wonderful piece of software, but to get started with it can be quite a challenge. The learning curve is steep. So I want to share some of the lessons learned. It really helps if you are acquinted with the Eclipse environment, upon which CityEngine is based. Eclipse comes in many guises, Aptana (see also this post) and the Adobe Flash Builder being two that are sometimes used in GIS related activities.

Continue reading

Distributing custom ArcGIS toolboxes using Python Modules

ArcGIS Python Toolbox Distribution folder structure

image: courtesy Esri

A colleague of mine (thanks Marc!) came across a very handy mechanism to distribute your ArcGIS Python toolboxes and script tools. You can build your own Python Distribution to encapsulate a custom Python module, accompanying toolboxes and helpfiles and distribute it to your audience, by utilizing the Python Distribution Utilities (Distutils). It also builds an installer (such as “mytool-1.0-win32.exe” for Windows), that will install your module in the site-packages directory.

If you include a subdirectory “esri” in your project (see screenshot), any toolboxes or script tools will appear in the Systems Toolboxes in ArcGIS for Desktop, which is also very convenient.

The mechanism is described in the ArcGIS Python Help (here). The help item neatly describes which steps to take and also which naming conventions apply.