[PyKDE] Python based GIS application

Sundance sundance at ierne.eu.org
Thu Mar 20 22:27:00 GMT 2003


I heard Eron Lloyd said:

> I've been looking into working on a desktop GIS application, and not
> being quite brave enough to learn C++, was pondering using PyQt
> instead.

Hello Eron!

GIS happens to be the field I'm working in, and let me tell you that I 
would *LOVE* to see a PyQt-based GIS system. I wish you the best luck 
with it!

Unfortunately, I don't think you'll be able to entirely do away with a 
low level language, be it C or C++. Here's why.

To start with, in most practical applications, GIS must deal with a LOT 
of data. You'll often see applications needing to deal with thousands, 
if not tens of thousands of objects concurrently. The problem with 
Python there is twofold. 1) Memory consumption. A Python object will 
eat up much more memory than you'd believe, unfortunately. 2) Display 
speed. You'll need to be able to update very crowded data areas very 
fast (almost instantaneously). This might be worked around by using 
OpenGL for all displaying purposes, though. You'll still need to choose 
what to display and how, depending on relative sizes and scale and 
other factors, however.

Another problem is that some often used algorithms are very 
computationaly expensive. Most typical is probably Delaunay 
triangulation, which you end up needing for many tasks. I wrote a 
Delaunay triangulation algorithm in Python, and even using Psyco for 
JIT compilation, it's still too slow (not to mention that Psyco doesn't 
help any with the memory problem). I'm currently rewriting it in C++.

So, basically, you won't be able to do away with C++ entirely, I fear.

This being said, it may not be /that/ much of a problem, if you design 
the software carefully. I think Qt itself is a striking example of how 
thorough design can turn a wildly complicated endeavour (extensible 
cross-platform widgetry) into a completely modular framework. I've been 
trying to get inspiration from Qt's example since the moment I began 
understanding its power. :p

For example, triangulation can be implemented as an external object 
rather than an internal function. IE, instanciate a triangulator 
object, add points with an addPoint(x, y, z) method (there are optimal 
algorithms that will let you insert points one by one), and retrieve 
the resulting vertices one by one with another method, or with a method 
returning an iterator. Such an object is very easily SWIGable, so you 
can reuse it in any Python app or GIS module. This may sound obvious, 
but I have seen commercial (and very expensive at that!) GIS software 
that are still -miles- away from such flexibility (hence my need to 
rewrite the algorithm in the first place).

Damn, I'm ranting.

But anyway. Good luck, Eron, and keep us updated about your project. :)

-- S.




More information about the PyQt mailing list