Updated Mapnik Renderers (markdown)

ThomasG77 2011-12-12 12:16:42 -08:00
parent a521f27ea8
commit c28f13c0d7

@ -13,18 +13,18 @@ The AGG renderer ([Antigrain Geometry](http://antigrain.com)) is the primary ren
* Because the primary developer of AGG has moved on to other endeavors, we happily maintain our own version of AGG with bugfixes.
* Mapnik can also build against a system version of AGG, but this is NOT RECOMMENDED since packaged versions have likely not been updated with critical bug fixes
While Mapnik was the first to use AGG rendering for mapping, the AGG renderer is also now an optional rendering engine in the [http://mapserver.gis.umn.edu/docs/howto/agg-rendering-specifics MapServer] and [http://trac.osgeo.org/mapguide/wiki/MapGuideRfc40 MapGuide] projects.
While Mapnik was the first to use AGG rendering for mapping, the AGG renderer is also now an optional rendering engine in the [MapServer](http://mapserver.gis.umn.edu/docs/howto/agg-rendering-specifics) and [MapGuide](http://trac.osgeo.org/mapguide/wiki/MapGuideRfc40) projects.
## cairo_renderer | Cairographics
The [http://cairographics.org/ Cairo] renderer is an auxiliary renderer in Mapnik.
The [Cairo](http://cairographics.org/) renderer is an auxiliary renderer in Mapnik.
* Cairo was added in r656 due to its similar reputation for high quality graphics output to various formats
* http://trac.mapnik.org/log/trunk/src/cairo_renderer.cpp
* Cairo has the '''added advantage''' of supporting both Vector and Raster output.
* Mapnik can render to any [http://www.cairographics.org/manual/cairo-surfaces.html surface] supported by cairo, either directly or by rendering to a cairo [http://www.cairographics.org/manual/cairo-context.html context].
* You can demo the PNG, JPEG, SVG, PDF, and PS formats using the [http://openstreetmap.org/export/ OSM export tool]
* Mapnik can render to any [surface](http://www.cairographics.org/manual/cairo-surfaces.html) supported by cairo, either directly or by rendering to a cairo [context](http://www.cairographics.org/manual/cairo-context.html).
* You can demo the PNG, JPEG, SVG, PDF, and PS formats using the [OSM export tool](http://openstreetmap.org/export/)
* Cairo is optional during Mapnik Scons build process but is enabled automatically if found (using pkg-config).
* Pkg-config must find libcairo as well as Cairomm(C++ bindings) and Pycairo (python bindings)
* If Pkg-config is successful you will see the added compiler flags: `-DHAVE_CAIRO -DHAVE_PYCAIRO`
@ -34,7 +34,7 @@ The [http://cairographics.org/ Cairo] renderer is an auxiliary renderer in Mapni
Writing to SVG with Mapnik's Cairo renderer:
```python
import mapnik
import cairo
@ -55,17 +55,20 @@ Writing to SVG with Mapnik's Cairo renderer:
surface = cairo.PDFSurface('mapfile.pdf', mapnik_map.width, mapnik_map.height)
mapnik.render(mapnik_map, surface)
surface.finish()
```
* Note: Cairo can also write to PostScript and other image formats
* Note: 'mapnik.render()' can also render to Cairo Contexts
## svg_renderer
The SVG renderer is written by Carlos López Garcés, started as part of GSOC 2010 and the "better printing project". The idea is that while the Cairo backend offers both PDF and SVG support, we can do better by having a custom implementation to handle things such as layer grouping, re-used of svg/bitmap symbols, and texts on paths. Only the basics are implemented at this point and those needed custom features are still a ways off, but the renderer has much promise. Currently is is not built by default but can be enabled with the build flag `SVG_RENDERER=True`.
The svg_renderer uses some very cool features of boost karma to generate SVG really fast and should be a good example of ways to leverage boost karma more in the future, potentially for other types of innovative vector output.
## grid_renderer
The Grid renderer is designed to output highly optimized feature "hit grids". It does this by leveraging and extending modular parts of the antigrain geometry library to rasterize feature id's into a buffer, then outputs metadata about the relevant feature attributes for the given ids, all enclosed within a compact, highly compressible json file. The grid_renderer will first be available in the Mapnik 2.0 release and landed in trunk in r2840.
There is a sample application showing how to use the output at https://github.com/springmeyer/gridsforkids#readme.