SLD and Python

Ireland topography and electoral districts

[PCL-MapServer output (full size, 145kb)]

I've been thinking a bit more about PCL and mapnik and their separate implementations of SLD. Compatibility would be great, but it might be easier said than done. The problem with sharing an SLD implementation is that mapnik is a C++ framework with Python bindings, while PCL is a Python framework with some C extensions.

Mapnik uses Boost.Python, which makes it very easy to access C++ code from Python. Going the other way is not nearly as easy. I can't tell yet if Boost's support for execution of Python is as good as what SWIG provides through directors. At any rate, to use the PCL styling classes, mapnik developers would have to get very intimate with the Python C API: PyObject_GetAttr() and friends. I assume the mapnik renderer has code that pivots on the C++ type of symbolizers, and some kind of adapter would have to be written. This isn't hard, but it's not trivial either.

Comments

Re: SLD and Python

Author: Chris Holmes

Yay code sharing! I have no idea how relevant it is in the Python world, and if you can get the same implementation that's the way to go. But one compromise we go for with GeoTools is to encourage others to do the same interface, which allows people to do their own thing in implementation, yet makes it so you can share somem code.