#include #include #include #include #include #include #include #include #include using namespace mapnik; #include #include using namespace std; int main(int argc,char *argv[]) { if(argc < 6) { std::cerr<<"Usage: render XMLfile w s e n [OSMfile]" << std::endl; exit(0); } datasource_cache::instance()->register_datasources ("/usr/local/lib/mapnik/input"); freetype_engine::register_font ("/usr/local/lib/mapnik/fonts/DejaVuSans.ttf"); Map m (800,800); load_map(m,argv[1]); if(argc>6) { parameters p; p["type"] = "osm"; p["file"] = argv[6]; for(int count=0; countparams(); m.getLayer(count).set_datasource(datasource_cache::instance()-> create(p)); } } box2d bbox (atof(argv[2]),atof(argv[3]), atof(argv[4]),atof(argv[5])); m.zoomToBox(bbox); image_32 buf (m.getWidth(), m.getHeight()); agg_renderer r(m,buf); r.apply(); save_to_file(buf.data(),"blah.png","png"); return 0; }