On May 31, 2011, at 6:46 AM, Ryan McCall wrote:

> So I recently started running mapnik 0.7.1 on Windows xp and I am trying to 
> find a way to save and access the layers I load using python. To start, I use 
> the code below to create the layer from  a database table and I have access 
> to it.
>    lyr = Layer(t)
>    lyr.datasource = PostGIS(host=h,port=p,user=u,password = pw, 
> dbname=dbn,table=t)
> I was wondering how I should save the layer so that after I close Python and 
> reopen it, I can get access to the layer  without having to remake the layer 
> from the database. Any advice or providing links to relevant documentation 
> would be greatly appreciated.
> 

Hi Ryan,

As long as you pass the 'extent' parameter, the creation on the fly of a 
PostGIS datasource should be quite fast. So, can you store the extents of your 
table in your database table and use that when you re-create the Mapnik layer?

If you truly want to stash the list of mapnik postgis parameters then pickling 
a python dictionary might work nicely.

Dane

> _______________________________________________
> 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