-
Notifications
You must be signed in to change notification settings - Fork 826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SVG-Based Symbolizers #320
Comments
[cdestigter] We've been looking at implementing this. I'm fairly new to the mapnik codebase, but after a bit of poking here's a plan:
This means:
Any feedback before I start writing code? |
[rcoup] Stuff around extending PointSymbolizer to support primitives: |
[springmeyer] cc'ing tom as I know that he may have ideas on this, particularly as it relates to cairo usage |
[rcoup] MapServer is doing a GSoC project currently around adding SVG symbol support, might be worth getting in touch with Kiran/Daniel about their plans: |
[springmeyer] the thread breaks on the month, so notice the may group: |
[springmeyer] Craig, great stuff - I've noticed your work at github. So, currently Cairo is an optional dependency. Will librsvg usage use make it such that Cairo is a mandatory dependency? Also, just curious which other svg libs you reviewed and what makes librsvg the best? |
[springmeyer] Ah, also just noticed in your plan notes a potential dependecy of the AGG renderer on Cairo for svg rendering. It will be important to make sure this does not incur a performance hit for general rendering without svg symbols when using AGG. |
[iandees] It would be extremely handy if this supported the ability to use some field somewhere to specify which SVG file to use or the contents of some text field in the SVG. For example, it'd be nice to only have to use one SVG file for US Interstates and say that data value X belongs in the center (oh, and scale the width of the SVG to fit the number). This is just a nice-to-have at this point, though. |
[cdestigter] springmeyer: iandees: |
[springmeyer] Replying to [comment:10 cdestigter]:
Great, sounds good. Thanks for the clarification.
Yes, we should close #155 soon and re-open a few tickets clarifying potential goals for raster scaling. |
[cdestigter] I've run out of time for my part of this. My latest code will be on github momentarily. What works and doesn't work:
|
[cdestigter] Latest source is now at http://github.com/craigds/mapnik/tree/svg The attached zip file includes some handy testing code (generates 32 map images for different input symbols, scales and allow_overlap values using both renderers). |
[cdestigter] "I've run out of time" = I'll get back to this in a few weeks, but not before. If anyone feels like moving this forward in the meantime, that'd be great. |
[springmeyer] Craig, I had a chance to pull down from git, build, and run your tests.
updated testing script snippet: {{{ backtrace of crash when running tests without librsvg compiled in: {{{ Date/Time: 2009-05-26 19:29:02.890 -0700 Exception Type: EXC_BAD_ACCESS (SIGBUS) Thread 0 Crashed: Thread 0 crashed with X86 Thread State (32-bit): |
[cdestigter] I've fixed the scaling in both AGG and Cairo for both raster and vector symbols (latest code is on github) I didn't try running the nose tests until after implementing the scaling stuff, but they seem to work for me okay, even without librsvg. |
[springmeyer] Awesome, the svg_symbols_test ran well (still using the modified cairo png out). Looks fantastic, and works as expected. The only small things I notice are a small shift between location of the red dots in the agg and cairo scaled raster point icons, and slightly slower quality in the resampling in the agg output for the raster icons. Looks like it may be time to think about steps to merge this into trunk. Thinking about the XML loading and saving issues... I wonder about the benefit/value of being able to inline SVG as well as reading from a file. |
[springmeyer] Hmm, so I'm starting to realized that the dependecies for librsvg are surprisingly tangled. Libxml2 and libart are fine, but it needs rendering via gtk it looks like, and the gtk framework needs a whole smack of other stuff. Craig, what os and what build procedure have you been using to compile librsvg? What are the minimum features we need from it? |
[cdestigter] I've just been using the librsvg package in Ubuntu 8.10 (librsvg 2.22.3-0ubuntu1). A major attraction of librsvg is that it will render to a Cairo context with very little code (just call the rsvg_handle_render_cairo() function). As a result the code that actually depends on librsvg is fairly minimal and could be replaced by something else if someone can suggest an alternative and someone can donate the time. However, since librsvg is an optional dependency anyway, I would assume that depending on gtk is reasonable. Correct me if I'm wrong.. |
[springmeyer] Replying to [comment:19 cdestigter]: Great, thanks for the info.
okay. I was wondering if you had been compiling from source and found tricks that I was missing to build a 'lite' version of librsvg. I was trying on Mac osx from source and from my build notes it looks like these are the additional dependencies (beyond cairo stuff) needed to build libsvg: {{{ hopefully optional once I figure out the builds:
Okay, good to know.
Yes, totally reasonable. I also did a bit more background reading on librsvg and it certainly sounds like the right choice above other options that might have less depedencies. There are other good reasons for Mapnik to delve into these gnome libraries - particularly pango for unicode text support. I guess what prompted my earlier head scratching is thinking about Windows builds, and that these types of dependencies may make a fully functioning Mapnik on win32 a more distant goal. The lead cartographer on the OSM project runs on windows, and I'm ultra sensitive to that given that the OSM stylesheets could benefit immensely from your awesome svg work. But, realistically we don't even have cairo or libxml2 support in the windows builds currently, so this concern is fully independent of librsvg stuff. Sorry about the sidetracking, and thanks so much for the hard work! -dane |
[springmeyer] Connected with Artem about this last week and he mentioned looking into the svg parsing within AGG behind the http://www.antigrain.com/svg/index.html. Source code is in 'agg-src/examples/svg_viewer'. Also, I was part of brief discussions on mapserver IRC about their GSOC project yesterday. It looks like they are also going to be looking into using the AGG parsing: http://lists.osgeo.org/pipermail/mapserver-dev/2009-July/008910.html |
[springmeyer] For now, moving this ticket to 0.7.0 since that is the proper spot to continue discussion and hopefully integrate a solution. |
[rcoup] The AGG SVG example is a demo. It supports line, polygon, path, and rect objects, and simple fills/strokes/opacities/transforms. Better than nothing, certainly, but no gradients, symbols, curves, etc which are arguably the good bits :) Craig's system is fairly pluggable so it should be able to use homegrown/AGG code as a fallback is librsvg isn't available. Not sure if that's a desirable solution though - you'd get vastly differing output depending on which SVG parser you used. |
[cdestigter] The above patch applies to svn r1287 (use -p1 ) |
[springmeyer] fyi, see thread starting with: http://lists.cairographics.org/archives/cairo/2009-October/018332.html |
[cdestigter] Using qt might prove worthwhile, but it's a moderate time investment. As I mentioned above, rsvg has the rsvg_handle_render_cairo() function which makes things easy. A bit of flicking around in the Qt docs suggests we'd have to do the following to switch to using Qt's SVG module:
|
[rcoup] Does QT have QPaint* implementations that produce SVG or PDF? |
[cdestigter] [http://qt.nokia.com/doc/4.5/qsvggenerator.html QSvgGenerator] produces SVGs, so I guess we could use that instead of Cairo for outputting SVGs. It's probably cleaner to implement the draw() methods for Cairo than to create a whole new mapnik renderer though. |
[MaZderMind] I updated cdestigter's patch to the current svn version 1433. It solves the scale problem with svg icons and it works for point_symbolizer and shield_symbolizer. It does not yet work for line_pattern_symbolizer, polygon_pattern_symbolizer and raster_symbolizer(?). I'm working on this, as I'm working on a vector-only version of the osm style. |
[MaZderMind] I'm sorry i attached the wrong patch. It was missing svg_reader.cpp. I replaced the patch with a correct one. |
[springmeyer] discussing how to get this (or a modified patch) landed in trunk seems like a top priority to me, so bumping priority level of ticket.... |
[artem] Implemented in trunk for AGG renderer. |
[springmeyer] implemented for cairo in r2532 (along with gradients for both agg and cairo - #654) |
It would be very nice to allow for arbitrary SVG shields as symbolizers on areas, points, and lines.
This would allow (e.g.) US Interstate highway shields and other similar features.
See also: https://lists.berlios.de/pipermail/mapnik-users/2009-April/001809.html
The text was updated successfully, but these errors were encountered: