void render_with_vars(mapnik::Map const& map,
            mapnik::image_any& image,
            boost::python::dict const& d,
            double scale_factor = 1.0,
            unsigned offset_x = 0u,
            unsigned offset_y = 0u)
{
    mapnik::attributes vars = mapnik::dict2attr(d);
    mapnik::request req(map.width(),map.height(),map.get_current_extent());
    req.set_buffer_size(map.buffer_size());
    python_unblock_auto_block b;
    mapnik::util::apply_visitor(agg_renderer_visitor_3(map, req, vars, scale_factor, offset_x, offset_y), image);
}
 backend_type backend(tile,16);
 mapnik::Map map(tile_size,tile_size,"+init=epsg:3857");
 map.set_buffer_size(256);
 mapnik::layer lyr("layer",map.srs());
 mapnik::parameters params;
 params["type"] = "gdal";
 // created with:
 // wget http://www.nacis.org/naturalearth/50m/raster/NE2_50m_SR_W.zip
 // gdalwarp -t_srs EPSG:3857 -ts 1048 1048 -r bilinear NE2_50M_SR_W.tif natural_earth.tif
 params["file"] = "test/natural_earth.tif";
 MAPNIK_SHARED_PTR<mapnik::datasource> ds =
     mapnik::datasource_cache::instance().create(params);
 lyr.set_datasource(ds);
 map.MAPNIK_ADD_LAYER(lyr);
 mapnik::request m_req(tile_size,tile_size,bbox);
 m_req.set_buffer_size(map.buffer_size());
 renderer_type ren(backend,map,m_req,1.0,0,0,1,"jpeg",mapnik::SCALING_BILINEAR);
 ren.apply();
 CHECK(1 == tile.layers_size());
 mapnik::vector::tile_layer const& layer = tile.layers(0);
 CHECK(std::string("layer") == layer.name());
 CHECK(1 == layer.features_size());
 mapnik::vector::tile_feature const& f = layer.features(0);
 CHECK(static_cast<mapnik::value_integer>(1) == static_cast<mapnik::value_integer>(f.id()));
 CHECK(0 == f.geometry_size());
 CHECK(f.has_raster());
 std::string const& ras_buffer = f.raster();
 CHECK(!ras_buffer.empty());
 // debug
 bool debug = false;
 if (debug) {