Hi,
I have a simple question concerning reprojection. It's probably just
some stupid thing I'm doing wrong but I cannot find it.
I have my PostGIS database initialized with lat/lon data (through
osm2pgsl with the -l option). All the layers in the map file have
srs="+init=epsg:4326" set, and the enclosing <Map> object as well.
When I create images in EPSG:4326, everything works fine as expected;
the following python script...
mapfile = "osm.xml"
map_uri = "karlsruhe.png"
ll = (8.32, 48.95, 8.48, 49.07)
imgx = 400
imgy = 300
m = Map(imgx,imgy)
load_map(m,mapfile)
prj = Projection("+init=epsg:4326")
c0 = prj.forward(Coord(ll[0],ll[1]))
c1 = prj.forward(Coord(ll[2],ll[3]))
bbox = Envelope(c0.x,c0.y,c1.x,c1.y)
m.zoom_to_box(bbox)
im = Image(imgx,imgy)
render(m, im)
view = im.view(0,0,imgx,imgy) # x,y,width,height
im.save(map_uri,'png')
... gives me a proper map of Karlsruhe within one or two seconds:
http://www.remote.org/frederik/tmp/right.png (I know the forward
projection is a null operation in this case, I just have the code in
there always.)
Now I simply want the same image shown in a Mercator projection. For now
it doesn't matter which, I choose to go ahead with the spherical
mercator used in OSM circles. So I change the <Map> element of my map
file to have
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0
+y_0=0 +k=1.0 +units=m [EMAIL PROTECTED] +no_defs +over"
and I also change the projection initialization on the above python
script to
prj = Projection("+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0
+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m [EMAIL PROTECTED] +no_defs +over")
I leave all the other "srs" thingies in my map file unchanged since they
describe the projection of the source data, which remains unchanged.
This time, the script runs for about 20 seconds, and produces an image
that has a wee bit of forest painted somewhere on the side - completely
off (http://www.remote.org/frederik/tmp/wrong.png).
Now what is wrong here? I know that I could load my data into PostGIS
using the desired projection but I want Mapnik to project it for me so
that I can use anything. I have tried different projections from the
above spherical mercator, e.g. EPSG:3395, but had the same problem.
Any ideas?
Thanks
Frederik
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users