I'm trying to read a raster file.     In this particular test case I've
got a geotiff, but with no valid projection info - does it default to
using pixel space if no projection info?   Here is my code for reading:

************************************************************************
******
                // Setup mapnik
        
mapnik::datasource_cache::instance()->register_datasources("../"); 
        
mapnik::freetype_engine::register_font("../DejaVuSans.ttf");
        
                mapnik::Map map(vm["out_width"].as<int>(),
vm["out_height"].as<int>());
        
map.set_background(mapnik::color_factory::from_string("white"));        
       
                mapnik::parameters param;
                param["type"]="gdal";
                param["file"] = InputFile.string();
                mapnik::Layer layer("raster");
        
layer.set_datasource(mapnik::datasource_cache::instance()->create(param)
);
                map.addLayer(layer);

                //map.zoomToBox(mapnik::Envelope<double>(371440.5,
3693172.5, 371640.5, 3693372.5));
                map.zoomToBox(mapnik::Envelope<double>(0,0,6000,6600));
        
                mapnik::Image32 buf(map.getWidth(),map.getHeight());
                mapnik::agg_renderer<mapnik::Image32> ren(map,buf);
                ren.apply();
        
mapnik::save_to_file<mapnik::ImageData32>(buf.data(),fname.string(),"png
256");
************************************************************************
******

All I've been able to do is to get out a blank [white] image.   I have
tried another image with projection info to no avail.    In one of the
list messages I found reference to having to give parameters for
lox,loy,hix,hiy when reading the raster in a python script so I tried
giving additional parameters with those names like so:
param["lox"] = 0;
param["loy"] = 0;
param["hix"] = 6000;
param["hiy"] = 6000;



Can anyone point out what I may be doing wrong here?  I've been unable
to find any C++ mapnik example for raster input, does it work?  Does the
gdal plugin even work?

Thanks in advance,
matt
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to