$t->is($result, true, 'Feature style \'popplaces\' added to map');
$p = new Mapnik\Parameters();
$t->isnt($p, null, 'Created parameters to pass to layer');
$p->set('type', 'shape');
$p->set('file', '../mapnik-0.7.1/demo/data/popplaces');
$p->set('encoding', 'latin1');
$lyr = new Mapnik\Layer('Populated places');
$t->isnt($lyr, null, 'Created layer \'Populated places\'');
$shapefile_datasource = Mapnik\DatasourceCache::create($p);
$t->isnt($shapefile_datasource, null, 'Shape file data source created');
$lyr->setDatasource($shapefile_datasource);
$t->pass('Data source set');
$lyr->addStyle('popplaces');
$t->pass('popplaces style added');
$m->addLayer($lyr);
$t->pass('Layer added');
// Render the map
$m->zoomToBox(new Mapnik\Envelope(1405120.04127408, -247003.813399447, 1706357.31328276, -25098.593149577));
$t->pass('Zoomed to box');
$buf = new Mapnik\Image32($m->getWidth(), $m->getHeight());
$t->isnt($buf, null, 'Created Image32 image buffer');
// @todo test width and height
$agg_renderer = new Mapnik\AggRenderer($m, $buf);
$t->isnt($agg_renderer, null, 'Created renderer');
$agg_renderer->apply();
$t->pass('Agg renderer apply() didn\'t crash');
// Save the map
Mapnik\save_to_file($buf, 'demo.jpg', 'jpeg');
Mapnik\save_to_file($buf, 'demo.png', 'png');
Mapnik\save_to_file($buf, 'demo256.png', 'png256');
$t->isnt($nuts3_rule, null, 'Created Rule');
$nuts3_rule->append($nuts3_symbolizer);
$t->pass('Appended symbolizer to rule without crashing');
$nuts3_feature_style = new Mapnik\FeatureStyle();
$t->isnt($nuts3_feature_style, null, 'Created feature style');
$nuts3_feature_style->addRule($nuts3_rule);
$t->pass('Rule added to feature style without crashing');
$m->addStyle('nuts3', $nuts3_feature_style);
$t->pass('Style added to map');
$p = new Mapnik\Parameters();
$p->set('type', 'shape');
$p->set('file', '../sample data/NUTS_03M_2006_SH/data/NUTS_BN_03M_2006');
$p->set('encoding', 'latin1');
$shapefile_datasource = Mapnik\DatasourceCache::create($p);
$t->pass('Shapefile datasource created');
$lyr = new Mapnik\Layer('NUTS3 regions');
$lyr->setDatasource($shapefile_datasource);
$lyr->addStyle('nuts3');
// Add query here:
// STAT_LEVL_ = 0
$m->addLayer($lyr);
// Render the map
// LL: -11.96 ,36.59
// UR: 44.31 ,72.12
$m->zoomToBox(new Mapnik\Envelope(-11.96, 36.59, 44.31, 72.12));
$buf = new Mapnik\Image32($m->getWidth(), $m->getHeight());
$agg_renderer = new Mapnik\AggRenderer($m, $buf);
$agg_renderer->apply();
// Save the map
Mapnik\save_to_file($buf, 'demo.png', 'png');