python mapscript processLegendTemplate()

Sean Gillies sgillies at FRII.COM
Wed Jan 12 15:12:40 EST 2005


On Jan 12, 2005, at 11:02 AM, Vincent Schut wrote:

> Hi all,
>
> is map.processLegendTemplate() in python mapscript (cvs upped today)
> supposed to work? Or are the typemaps not yet enabled?
> I don't seem to be able to get it to work, actually, and would like to
> know if this is my fault :-)

No, Vincent, not your fault.  As far as I know, the template processing
methods in mapscript have never worked.   I believe (correct me if I'm
wrong) that they were added to the SWIG file based on a
misunderstanding of SWIG's built-in type mapping.

>  From the source I see that I am supposed to supply a names, a values
> and  a numItems paramter. What are these? If I supply (None, None, 0) I
> get the following error in apache's errorlog:
>
> [Wed Jan 12 18:54:26 2005] [error] [client 127.0.0.1] PythonHandler
> mod_python.publisher:   File
> "/usr/lib/python2.3/site-packages/mapscript.py", line 902, in
> processLegendTemplate\n    def processLegendTemplate(*args): return
> _mapscript.mapObj_processLegendTemplate(*args)
> [Wed Jan 12 18:54:26 2005] [error] [client 127.0.0.1] PythonHandler
> mod_python.publisher: MapServerError: msFreeHashItems(): Hash table
> error.Can't free NULL table\nmsFreeHashItems(): Hash table error. Can't
> free NULL table
>
> If I supply any other thing than None's as first/second argument, I get
> complaints about the argument type (should be pointer and/or p_p_char).
>
> Btw, I saw an item in the bugzilla about a problem that looked similar,
> but was about java mapscript (bug 1128).
>
> Any suggestions are welcome! I would really like to have html legends
> working in python mapscript...
>
> Cheers,
> Vincent.
>
>

If you can commit a working patch, I'll merge it into CVS for you.  I
am also happy to give you pointers to better templating systems, but
can't spare the time to write the typemaps for template processing.

cheers,
Sean

--
Sean Gillies
sgillies at frii dot com
http://users.frii.com/sgillies



More information about the mapserver-dev mailing list