Anisha,

The Mapnik feature of using named styles can be confusing at first,  
but in time you'll see its power.

In your case I look at the cpp file and cannot see a problem. But, if  
I compile it and add an extra function to serialize the XML mapfile,  
then I see the issue immediately, which is that you are simply not  
naming your styles that you attach to your map and your layers the same.

So, what happens then when no styles match between the layers and map  
is nothing is rendered.

In your cpp file add at the top:

#include <mapnik/save_map.hpp>

and at the bottom:

save_map(m,"map.xml");

Then open that "map.xml" file up and inspect the lack of correct  
naming between the styles attached to the layers and the actual styles  
themselves, which in the C++ and python API's are appended to the map  
object.

Don't fret. I frequently make this mistake too, and the lesson is that  
looking at the XML can really help bring out problems, while  
programming in the api can be very powerful once you get the gist of  
how to attach styles to the map and layers.

Dane

On Jan 18, 2010, at 5:59 AM, Anisha Kaul wrote:

> Hello to all,
>
> I have succesfully rendered a map through Postgres datasource using  
> Python API.
> Now I am trying to do the same through C++ API.
>
> The map doesn't get shown when through C++ program.
>
> The only major difference I found in compilation output was the  
> "Scale"
>
> Here by I have attached the Python as well as C++ code as well as  
> their respective outputs.
>
> Kindly help,
> Thanks!
>
> -- 
> Regards,
> Anisha Kaul
> <rundemo.py><outputRundemo.py><rundemo.cpp><outputRundemo.cpp>
>
> -------------------------------------
> Hi-Tech Gears Limited, Gurgaon, India
>
> _______________________________________________
> Mapnik-users mailing list
> [email protected]
> https://lists.berlios.de/mailman/listinfo/mapnik-users

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

Reply via email to