Hi all,

How can I draw 2 shapefiles in the same map?
I've try the code below but I didn't work.

#!/usr/bin/env python

from mapnik import *
m = Map(600,300,'+proj=latlong +datum=WGS84')

m.background = Color('steelblue')
s = Style()
r=Rule()
r.symbols.append(PolygonSymbolizer(Color('#f2eff9')))
r.symbols.append(LineSymbolizer(Color('rgb(50%,50%,50%)'),0.1))
s.rules.append(r)
m.append_style('My Style',s)

lyr = Layer('world')
lyr.datasource = Shapefile(file='../data/world_borders')
lyr.styles.append('My Style')
m.layers.append(lyr)

# I am a newbie in Python! :)
# Now I want to draw some text on the same map
# But it does appear on the map.
lyr2 = Layer('nations_name')
lyr2.datasource = Shapefile(file='../data/nations_name')
lyr2.styles.append('My Style')
m.layers.append(lyr2)

m.zoom_to_box(lyr.envelope())
render_to_file(m, 'map/hello_world_in_pure_python.png')
render_to_file(m, 'map/hello_world_in_pure_python_small.png','png256')
save_map(m, 'map/hello_world_in_pure_python.xml')


-- 
Best Regards,
Nguyen Hung Vu ( Nguyễn Vũ Hưng )
[EMAIL PROTECTED] , YIM: vuhung16 , Skype: vuhung16dg
A brief profile: http://www.hn.is.uec.ac.jp/~vuhung/Nguyen.Vu.Hung.html
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to