[Baypiggies] Python SVG and CGI

Andy Wiggin andywiggin at gmail.com
Thu Jan 28 05:23:06 CET 2010

On Wed, Jan 27, 2010 at 2:03 PM, Silas Toms <me at silastoms.com> wrote:
> I’m trying to create a Python CGI application that will serve dynamically
> generated SVG maps (mostly of parcel data generated using supplied GPS
> coordinates) but I seem to be hitting the twin limitations of my (lack of)
> knowledge of CGI and the sparseness of Python CGI documentation with regards
> to the inclusion of SVG embeds or objects. Do any of you have any
> information/documentation that you could point me towards?
> The whole thing is so frustrating because this seems really promising, and I
> feel like I’m so close to creating something really useful.
> PS I’m more of a GIS guy so even the most basic info might be what I need.

I haven't done quite you're trying to do, but I have served SVG files
from a web server. In the spirit of offering you the most basic info,
I have two tips, both of which you may already know. The Internet
Explorer web browser is not too friendly towards SVG, so if you're
testing with IE, it could be part of your problem. Second is that when
your CGI script services the request for the SVG file, you probably
have to set the content type correctly. Modifying the example from the
Python CGI module docs, you would want something like:

print "Content-Type: image/svg+xml"
print                               # blank line, end of headers


More information about the Baypiggies mailing list