

def render(qs, options):
    kwargs = {
        
    }
    if options:
        if (';' in options):
            for item in options.split(';'):
                if (':' in item):
                    (k, v) = item.split(':')
                    kwargs[k] = v
    width = int(kwargs.get('width', 600))
    height = int(kwargs.get('height', 600))
    if hasattr(qs, '_meta'):
        qs = qs.objects.all()
    m = mapnik.Map(width, height)
    m.aspect_fix_mode = mapnik.aspect_fix_mode.GROW_CANVAS
    adapter = PostgisLayer(qs)
    lyr = adapter.to_mapnik()
    sty = adapter.get_default_style()
    lyr.styles.append('style')
    m.append_style('style', sty)
    m.srs = lyr.srs
    m.layers.append(lyr)
    m.zoom_all()
    mod = qs.query.get_meta().module_name
    name = ('%s_%s_%s_%s.png' % (mod, width, height, random()))
    map_graphic = os.path.join(graphics, name)
    mapnik.render_to_file(m, str(map_graphic))
    url = os.path.join(settings.MEDIA_URL, 'mapgraphics', name)
    return mark_safe(force_unicode(('<img src="%s" />' % smart_str(url))))

dataset/ETHPy150Open springmeyer/djmapnik/djmapnik/templatetags/mapgraphics.py render/original