I tried to change the demo/c++/rundemo.cpp from mapnik to use it with
my stylesheet instead of the demo, but it doesn't work. Here is a part
of the code (I deleted a lot but of style instructions but added only
1 line with load_map)
// $Id$
#include <mapnik/map.hpp>
#include <mapnik/datasource_cache.hpp>
#include <mapnik/font_engine_freetype.hpp>
#include <mapnik/agg_renderer.hpp>
#include <mapnik/filter_factory.hpp>
#include <mapnik/color_factory.hpp>
#include <mapnik/image_util.hpp>
#include <mapnik/config_error.hpp>
#include <mapnik/load_map.hpp>
#if defined(HAVE_CAIRO)
// cairo
#include <mapnik/cairo_renderer.hpp>
#include <cairomm/surface.h>
#endif
#include <iostream>
int main ( int argc , char** argv)
{
if (argc != 2)
{
std::cout << "usage: ./rundemo <mapnik_install_dir>\nUsually
/usr/local/lib/mapnik\n";
std::cout << "Warning: ./rundemo looks for data in
../data/,\nTherefore must be run from within the demo/c++ folder.\n";
return EXIT_SUCCESS;
}
using namespace mapnik;
try {
std::cout << " running demo ... \n";
std::string mapnik_dir(argv[1]);
std::cout << " looking for 'shape.input' plugin in... " <<
mapnik_dir << "/input/" << "\n";
datasource_cache::instance()->register_datasources(mapnik_dir
+ "/input/");
std::cout << " looking for DejaVuSans font in... " <<
mapnik_dir << "/fonts/DejaVuSans.ttf" << "\n";
freetype_engine::register_font(mapnik_dir + "/fonts/DejaVuSans.ttf");
Map m(800,600);
m.set_background(color_factory::from_string("white"));
// load the style - INSERTED HERE
load_map(m,"/home/dreist/osm/mapnik/rules/osm-render-rules.xml");
m.zoomToBox(Envelope<double>(1405120.04127408,-247003.813399447,
1706357.31328276,-25098.593149577));
Image32 buf(m.getWidth(),m.getHeight());
agg_renderer<Image32> ren(m,buf);
ren.apply();
save_to_file<ImageData32>(buf.data(),"demo.jpg","jpeg");
save_to_file<ImageData32>(buf.data(),"demo.png","png");
save_to_file<ImageData32>(buf.data(),"demo256.png","png256");
std::cout << "Three maps have been rendered using AGG in the
current directory:\n"
"- demo.jpg\n"
"- demo.png\n"
"- demo256.png\n"
"Have a look!\n";
...
I get this error when executing:
$ ./rundemo /usr/local/lib/mapnik
running demo ...
looking for 'shape.input' plugin in... /usr/local/lib/mapnik/input/
looking for DejaVuSans font in... /usr/local/lib/mapnik/fonts/DejaVuSans.ttf
### Configuration error: Unable to find specified font face ''
I am doing this because I'd like to see if this renders the same as
the xml rendered from python.
cheers,
Martin
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users