Sensor Web, Geoprocessing, Security & GeoRM, Geostatistics, Semantics, 3D, Ilwis, Earth Observation

Integration of Ilwis-objects in Python

August 31st, 2015 @ 08:40 by Martin Schouwenburg
Posted in Communities, ILWIS

ilwisobjectsgeneralLast week I showed some (very) limited snap shots of the new user interface for Ilwis4. But the user interface is just one part of the Ilwis-objects framework. In fact, it isn’t the first major “client” we wrote for the framework. The first thing we did after the major parts of the core of the framework were written was write a Python interface.

Why Python? First of all, it is used for educational purposes at our institute. This is important for us, not only because there is a direct (albeit small) user base (at ITC of course, not in general), but also because we have a way of testing things and seeing how they work. Another reason why Python is a good choice for us is because we want to be able to run Ilwis-objects in server environments. As such, this is possible with the C/C++ base of the framework, but it is definitely easier with a Python front end. In addition, Python is a popular scripting language. Many packages offer Python interfaces and fortunately its very easy to mix different Python extensions. Ilwis-objects is the extension that gives access to GIS/RS functionality and data access. I am well aware that there are (of course) Python extensions that already do part of it, e.g. the GDAL Python extension. But “part of it” is just the problem. Each extension has its own paradigm, its own way of doing things. We too, no doubt. So you have to mix and match, learn each flavor and try to use it. With the Ilwis-objects we try to create a Python interface for the whole field of GIS/RS so the learning curve should be easier (one interface to bind them all). It helps of course that we have always had a strong scripting back end. There is also a (at this moment experimental) part which allows you to build a whole map visualization from a script, in fact it allows you to manipulate all properties of a view through Python.

So what about mapcalc and tabcalc and the whole scripting of ILWIS 3? Basically its gone, its functionality has merged with the Python interface and you will no longer write scripts in those “languages”. Sure you will be able to read and execute old style IWLIS 3 scripts; the ILWIS 3 connector (one of our plug-ins) reads those script files and executes them. But you no longer create them from Ilwis4, Python is the first class citizen.

There are two “clients” for Python (sort of). In one, Ilwis-objects is just an extension for a stand alone Python. In the other, Python is the integrated scripting language of Ilwis4. At the moment it still unclear how we want to integrate Python in Ilwis4 (though it works). As a reference to a seperate, stand-alone Python? As a fully self contained (in Ilwis4) Python? The latter is cleaner, but significantly increases the download side of Ilwis4. Ilwis4 runs fine without the Python script and many users couldn’t care less if they can’t script. But then again, there is an important group of users who do care. We will see how this pans out.

So how does this work in practice? We maintain a wiki about Ilwis-objects at GitHub Ilwis-objects wiki. Due to limitations of our resources, its not (yet) as complete as I would like, but this will grow. Take a look at the simple Python example. It illustrates how simple it is to access Ilwis-objects from Python (see the other examples below that text).  Download it and get the version we currently use. Note that this contains only a part of the functionality of ILWIS 3, since that is still work in progress. It is a very beta version (we get our person for Q&A later this year) but then again it gives a nice snaphot of what we are busy with in this respect.

0 Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment

Time limit is exhausted. Please reload CAPTCHA.