A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/mapnik/mapnik/wiki/MapnikRenderers below:

MapnikRenderers · mapnik/mapnik Wiki · GitHub

This page is outdated (see #3438). Please don't trust it.

Mapnik supports a variety of rendering backends. See OutputFormats for comparisons of different output formats.

agg_renderer | Anti-Grain Geometry

The AGG renderer (Antigrain Geometry) is the primary renderer in Mapnik.

While Mapnik was the first to use AGG rendering for mapping, the AGG renderer is also now an optional rendering engine in the MapServer and MapGuide projects.

cairo_renderer | Cairographics

The Cairo renderer is an auxiliary renderer in Mapnik.

Writing to SVG with Mapnik's Cairo renderer:

    import mapnik
    import cairo
    
    mapfile = 'mapfile.xml'
    projection = '+proj=latlong +datum=WGS84'
    
    mapnik_map = mapnik.Map(1000, 500)
    mapnik.load_map(mapnik_map, mapfile)
    bbox = mapnik.Envelope(-180.0,-90.0,180.0,90.0)
    mapnik_map.zoom_to_box(bbox)
    
    # Write to SVG
    surface = cairo.SVGSurface('mapfile.svg', mapnik_map.width, mapnik_map.height)
    mapnik.render(mapnik_map, surface)
    surface.finish()
    
    # Or write to PDF
    surface = cairo.PDFSurface('mapfile.pdf', mapnik_map.width, mapnik_map.height)
    mapnik.render(mapnik_map, surface)
    surface.finish()

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.

The Grid renderer is designed to output highly optimized feature "hit grids", known as UTFGrids (based on the final encoding format). 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 using utf8 encoded feature ids for space efficiency. The grid_renderer was first available in the Mapnik 2.0.0 release.

The UTFGrid spec provides details of the format:

https://github.com/mapbox/utfgrid-spec

See the implementations list for examples:

https://github.com/mapbox/utfgrid-spec/wiki/Implementations


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4