Hello,

i downloaded mapnik-0.6.0 yesterday, compiling and installing (also with
osm plugin) worked fine.

I got some example python scripts and tried to render a map, but did not
succeed.

I downloaded a file "example.osm" and additionally exported a region as
OpenStreetMap XML Data, Permalink:

http://www.openstreetmap.org/?lat=47.7822&lon=9.1346&zoom=13&layers=B000FTF

I also downloaded osm-styles.xml and osm.xml from trac.mapnik.org .

I'd like to render the map that i downloaded using python into a PNG and
use the styles and rules defined in osm-styles.xml.


My understanding is the following, can anybody please correct me when
i'm wrong?

I need to create a mapnik.Map

import mapnik

m = mapnik.Map(600, 600, "+proj=latlong +datum=WGS84")

And then i try to create Layers for all the Styles i'd like to use, set the
datasource to the osm file that i downloaded, set the zoom and render it.


st = ['world', 'world-1', 'builtup', 'places', 'text', 'water']
ostyle = '/local/ftp/osm/osm-styles.xml'
osm = mapnik.Osm(file='/local/ftp/osm/bodensee.osm')

for s in st:
    lyr = mapnik.Layer(s, "+proj=latlong +datum=WGS84")
    lyr.datasource = osm
    lyr.styles.append(s)
    m.layers.append(lyr)

mapnik.load_map(m, ostyle)

m.zoom_to_box(lyr.envelope())

mapnik.render_to_file(m, 'world.png', 'png')


But world.png is just empty.


Seems i'm doing something wrong, is it ok to use mapnik.load_map() to
load the styles?  I did not find anything in the documentation.


Thanks for any hints,
Torsten.

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

Reply via email to