On Wed, Jan 14, 2009 at 1:19 PM, Jay Douillard <[email protected]> wrote: > If you are making a web mapping application using OpenLayers, etc. you could > make a html based legend that changes based on openlayers events. In my case > I have it changing depending on the base layer selected as all of the base > layers are choropleth maps that require different legends. I've used a table > to make mine so using prototype or jquery you can change just parts of the > legend, such as the range of a class of data. > > Matt, > I'd love to find a way to do what you are doing with png with pdfs. The > mapnik pdf output is great, I'd like to implement a print map button that > would render a pdf map of the current extent with a proper legend! >
Maybe pycairo would work? There is some stuff in http://trac.mapnik.org/browser/trunk/demo/python/rundemo.py that shows it being used. I assume you could draw anything you want on your surface before you render it. I never used it but probably will soon. It looks pretty nice. http://www.tortall.net/mu/wiki/CairoTutorial http://zetcode.com/tutorials/cairographicstutorial/cairobackends/ > I've looked at http://pybrary.net/pyPdf/, looks like the merge function might > work, for this. PIL doesn't open pdfs correct? > > > > > ---- > Jay > > > ----- Original Message ----- > From: "Matt Bartolome" <[email protected]> > To: "Nop" <[email protected]> > Cc: [email protected] > Sent: Wednesday, January 14, 2009 10:08:43 AM GMT -08:00 US/Canada Pacific > Subject: Re: [Mapnik-users] Creating map keys > > On Wed, Jan 14, 2009 at 9:51 AM, Nop <[email protected]> wrote: >> >> Hello! >> >> >> The mapnik-rendered map I am working on is still lacking a map key. I am >> a bit at a loss how to set up something for a map key efficnetly, >> considering that it is likely that it will have to be re-rendered as the >> map changes. >> >> Has any of you a recommendation, a trick or an example for this? >> > > I've done something like this with PIL (python imaging library). This > assumes a static legend saved as png but you could dynamically create > it as well through pil (drawing text, colored boxes ect). It goes > something like this: > > import Image > > legend = Image.open("legend.png") > base = Image.open("base_map.png") > base.paste(legend, (0,0), legend) > image_file = "new_with_legend.png" > base.save(image_file) > > I don't know if there is an easier way through mapnik but this is how > I decided to do it. > > -matt > >> >> thanks >> Nop >> _______________________________________________ >> Mapnik-users mailing list >> [email protected] >> https://lists.berlios.de/mailman/listinfo/mapnik-users >> > _______________________________________________ > Mapnik-users mailing list > [email protected] > https://lists.berlios.de/mailman/listinfo/mapnik-users > _______________________________________________ Mapnik-users mailing list [email protected] https://lists.berlios.de/mailman/listinfo/mapnik-users

