Hi,
I would like to render tiles in svg using the cairo_renderer. Here is what I have so far:
The code write the svg image to stdout for now, but I would like to get it as a string in the end.
cairo_status_t writeCairo(void * closure, const unsigned char* data, unsigned int length){
cout << string((const char*)data, length) << endl;
return CAIRO_STATUS_SUCCESS;
}
cairo_svg_surface_create_for_stream(writeCairo,NULL,width,height),mapnik::cairo_surface_closer();
mapnik::cairo_surface_ptr surface =
mapnik::cairo_surface_ptr(cairo_svg_surface_create_for_stream(writeCairo,NULL,width,height),
mapnik::cairo_surface_closer());
mapnik::cairo_ptr image_context(mapnik::create_context(surface));
mapnik::cairo_renderer<mapnik::cairo_ptr> svg_render(map_, image_context, 1.0);
The problem with the code is that the writeCairo function is called multiple times per tile and gives the
output in chunks. Is this behavior normal and can it be prevented? Any suggestions about the code above are
more than welcome.
Thanks
Igor