-----Alkuperäinen viesti-----
Lähettäjä: Martijn van Oosterhout [mailto:[EMAIL PROTECTED]
>Yes, though make sure you get the lat/lon <-> X/Y order correct.
>> 6. I tried blindly to feed in KKJ coordinates both into Envelope() and also
>> directly to m.zoom_to_box(bbox) but with no success. All I get back are
>> error messages telling me that I am feeding in numbers whith are of format
>> integer, or real or something else, depending on how I wrote the
>> coordinates, but not as DOUBLE which is the type that some C++ code is only
>> willing to eat.
>> Is there some simple way to modify generate_image.py in such a way that I
>> could get the coordinates I give to passed on as DOUBLE for the Mapnik for
>> Windows?
> Can't answer this question without seeing the code you tried to run.
> Can you paste the changed bits that failed?
Well, this is my story:
Well, I was thinking that perhaps bbox would like to have
the coordinates as
bbox(min-easting,min-northing,max-easting,max-northing)
I commended out almost everything from generate_image.py
Unchanged line here
>---snip---<
#---------------------------------------------------
# Change this to the bounding box you want
#
#ll = (24.889,60.14,25.07,60.29)
#ll = (-6.5, 49.5, 2.1, 59)
#---------------------------------------------------
#z = 10
imgx = 1000
imgy = 1000
m = Map(imgx,imgy)
load_map(m,mapfile)
#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")
#prj = Projection("+proj=tmerc +lat_0=0 +lon_0=27 +k=1.000000 +x_0=3500000
+y_0=0 +ellps=intl +towgs84=-90.7,-106.1,-119.2,4.09,0.218,-1.05,1.37 +units=m")
#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)
bbox = (3376400,6672200,3377400,6673200)
m.zoom_to_box(bbox)
im = Image(imgx,imgy)
render(m, im)
view = im.view(0,0,imgx,imgy) # x,y,width,height
view.save(map_uri,'png')
Result was this:
C:\mapnik>c:\python2.5\python generate_image_gosm_t.py
Traceback (most recent call last):
File "generate_image_gosm_t.py", line 45, in <module>
m.zoom_to_box(bbox)
Boost.Python.ArgumentError: Python argument types in
Map.zoom_to_box(Map, tuple)
did not match C++ signature:
zoom_to_box(class mapnik::Map {lvalue}, class mapnik::Envelope<double>)
I understood that bbox is willing to get its values from Envelope
and I tried the following:
bbox = Envelope(3376400,6672200,3377400,6673200)
m.zoom_to_box(bbox)
And because of mention of axis order also:
bbox = Envelope(6672200,3376400,6673200,3377400)
m.zoom_to_box(bbox)
Both those alternatives did render a map but they were empty.
I have OSM data from Finland only in PostGIS. I believe that
somehow bounding box gets changed from the one i was giving.
Then I tried to feed the coordinates directly for m.zoom_to_box as:
m.zoom_to_box(3376400,6672200,3377400,6673200)
Result:
C:\mapnik>c:\python2.5\python generate_image_gosm_t.py
Traceback (most recent call last):
File "generate_image_gosm_t.py", line 47, in <module>
m.zoom_to_box(3376400,6672200,3377400,6673200)
Boost.Python.ArgumentError: Python argument types in
Map.zoom_to_box(Map, int, int, int, int)
did not match C++ signature:
zoom_to_box(class mapnik::Map {lvalue}, class mapnik::Envelope<double>)
and:
m.zoom_to_box(3376400.0,6672200.0,3377400.0,6673200.0)
with result:
C:\mapnik>c:\python2.5\python generate_image_gosm_t.py
Traceback (most recent call last):
File "generate_image_gosm_t.py", line 47, in <module>
m.zoom_to_box(3376400.0,6672200.0,3377400.0,6673200.0)
Boost.Python.ArgumentError: Python argument types in
Map.zoom_to_box(Map, float, float, float, float)
did not match C++ signature:
zoom_to_box(class mapnik::Map {lvalue}, class mapnik::Envelope<double>)
I fear my trials do not make much sense. What might be the correct way
to order a rendered map in Finnish KKJ from a n area of, let's say,
(3376400,6672200,3377400,6673200)?
-Jukka Rahkonen-
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users