So I have been reading up on http://mapserver.org/cgi/wrapper.html and was wondering if there are any more substantial examples of creating a full-fledge web application (using Python and, if appropriate a Python web framework) to handle incoming GET and POST requests for a dedicated "mapserver.mydomain.com" WMS application.

Does such an approach make sense or will the "simple shell script" given in the example in http://mapserver.org/cgi/wrapper.html suffice?

Though frankly, I am not sure how the shell script is going to interface with the httpd server to handle GET/POST requests.

In particular, it may make sense to implement something like a Python tilecache for the MapServer instance so the shell script might not be sufficient?

1 Answer 1



For the WMS service itself MapServer already handles the GET and POST requests for the various requests (GetCapabilities, GetMap, etc). The wrapper script is basically to predefine a few things like the location of the map file that you might not want to normally expose to the end user.

There are situations in which you might want to customize your map definition based on additional parameters passed to your service or otherwise do special stuff for some kinds of WMS requests. To support some of these use cases I implemented the so called "WxS mapscript wrapper" mechanism. This makes it possible to write a python wrapper that customizes WMS, WFS, and other services to some degree or even radically transorms incoming request into something like a WMS request with interactions with the map object. This is documented at:


Implementing a Python tilecache this way would also be possible, perhaps it the python script looking in some sort of DB or filesystem cache to see if there is already an pre-rendered answer for the request and if so using it otherwise passing things on to mapserver. But before going to a lot of effort to implement a tile cache make sure one of the pre-existing tilecache implementations isn't going to meet your needs. For instance the tile cache project that is now part of the MapServer project. I'd like to provide a pointer to it but I can't immediately find it on the mapserver.org web site.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.