Hi Dana,
your nik2img works great. The only thing that irritates me is, that it
works better than the pure mapnik way. I stored my data now with SRS 25833
into Postgis (the code of the xml is the same as before, I only changed the
SRS and BBox-information so it fits SRS:25833). Well, if I just open it
with my own Python-file nothing happens - except a nice white picture again.
If I use nik2img everything is fine.
How could this happen?
Janes
Am schrieb Dane Springmeyer <[email protected]>:
Janes,
Glad it is working!
Note that you can pass a '--bbox' flag to nik2img that expects bounds in
lat/long (and will transform them internally to your map srs).
Dane
On Sep 15, 2010, at 8:43 PM, Janes Huff wrote:
Thank you, Dana!
Don't know wether to laugh or to cry now. At least a silly fault of mine.
Now it works.
CC or Janes
2010/9/15 Dane Springmeyer [email protected]>
On Sep 15, 2010, at 4:55 PM, Janes Huff wrote:
Hi,
I tried some tests with mapnik using osm data (download brandenburg.osm
from Geofabrik; cut out a smaller region with osm2pgsql: osm2pgsql --bbox
12.6247,52.2599,13.3848,52.5194 -m -d gis brandenburg.osm). All parts
(postgis, mapnik, ...) seem to work fine.
I created the two files:
a) werder.py (origin code I took from here:
http://trac.mapnik.org/wiki/XMLGettingStarted):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import mapnik
mapfile = 'werder.xml'
map_output = 'werder.png'
m = mapnik.Map(800, 600)
mapnik.load_map(m, mapfile)
bbox = mapnik.Envelope(mapnik.Coord(12.6247,52.2599),
mapnik.Coord(13.3848,52.5194))
m.zoom_to_box(bbox)
mapnik.render_to_file(m, map_output)
Your Map is in mercator so you need to pass mercator coordinates to the
zoom_to_box function.
Here is an example of reprojecting long/lat coords into spherical
mercator:
http://mapnik-utils.googlecode.com/svn/example_code/google_mercator_projection/world_mercator.py
You can also just render the werder.xml with nik2img.py which will
automatically zoom to the extents of your data (if set correctly, see
below).
b) werder.xml:
[...snip...]
strassenStyleName>
postgisParameter>
my-very-secret-pw
localhostParameter>
5432
postgresParameter>
gis
planet_osm_lineParameter>
falseParameter>
12.6247,52.2599,13.3848,52.5194
Your layer is going to be in spherical mercator () as it was imported
with the -m flag of osm2pgsql, so that means your extent value must also
be in spherical mercator coordinates (not long/lat). An easy solution
here is to let PostGIS calculate the layer's extents automatically (just
remove the 'extent parameter' to trigger this).
After execution I get no error message and the PNG-file I waited for.
Well, but it's blank - sorry - it's background color is #fffff (or
whatever color I setted). But no map features are shown.
I searched a lot by now, but couldn't figure out the mistake. Could you
give me a hint, please?
Thank you,
CC
PS:
OS: Kubuntu 10.4
Mapnik: 0.7
Postgresql: 8.4
Postgis: 1.5.1
osm2pgsql: 0.66.20090526
_______________________________________________
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