Experimental mod_python server for Mapnik #101

Closed
artemp opened this Issue Oct 11, 2011 · 10 comments

Comments

Projects
None yet
1 participant
Owner

artemp commented Oct 11, 2011

Hi,

I've been working on a mod_python compatible server wrapper for Mapnik: what we've been using in-house is using a PHP script to essentially proxy shelled-out Mapnik output, and we really want to switch to a standard platform with a WMS frontend.

This is a working implementation of a mod_python wrapper, based off of the CGI server code. The readme explains how to set it up locally, and there's a sample of a Apache configuration for this.

Owner

artemp commented Oct 11, 2011

[springmeyer] What kind of performance gains are you seeing using this server over the fcgi approach?

Owner

artemp commented Oct 11, 2011

[tmcw] I actually haven't thoroughly tested this module vs. fcgi. The main benefit of this driver is the fact that Mapnik could fit nicely into the rest of the mapping software I (and, I'm sure, others) are using - TileCache, FeatureServer, Django, etc., have mod_python as either a provided or a preferred Python environment.

Owner

artemp commented Oct 11, 2011

[springmeyer] Hey tmcw, maybe a wiki page explaining the use and possible improvements of this code would be more appropriate than a ticket?

But, if you are proposing that this code be added to enable mod_python support for the OGCServer, providing a patch(diff file) here would be most helpful.

thx!

Owner

artemp commented Oct 11, 2011

[tom] Hey, I've made a wiki page: ModServer , and I'll have a patch-version done soon.

Owner

artemp commented Oct 11, 2011

[springmeyer] Great!

Owner

artemp commented Oct 11, 2011

[tmcw] This is an improved version of the existing modserver.py, which properly handles exceptions and port numbers.

Owner

artemp commented Oct 11, 2011

[springmeyer] Cool tmcw. I'm curious if you've run this against mapnik trunk yet?

Also, have you ever used the wsgi wrapper? It will be interesting to benchmark a comparison since many say mod_wsgi can be faster than mod_python for a range of applications.

Owner

artemp commented Oct 11, 2011

[springmeyer] tmcw,

I've modified your patch quite a bit, but applied in r910 (Please also note r908 and r909)

Usage for the PYTHONHANDLER script (wms.py) script is now:

{{{
import sys
from mapnik.ogcserver.modserver import ModHandler
sys.path.append(/path/to/map_factory.py')
handler = ModHandler('/path/to/ogcserver.conf')
}}}

And a sample mod_python apache conf would be:

{{{
<Directory "/home/dane/projects/ogcserver/">
PythonPath "['/home/dane/projects/ogcserver/'] + sys.path"
AddHandler mod_python .py
PythonHandler wms

}}}

Please give it a rip and let me know if it still works for you.

Owner

artemp commented Oct 11, 2011

[springmeyer] Whoops, applied a radically wrong file in r910 - http://trac.mapnik.org/browser/trunk/bindings/python/mapnik/ogcserver/modserver.py?rev=911
for the correct file.

Owner

artemp commented Oct 11, 2011

[springmeyer] forgot to close this, as it will be in 0.6.0 release

(still needs docs however)

@artemp artemp closed this Oct 11, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment