Maybe I should expand:
I need to render a certain map area (random polygon, e.g. a park, part of the city, or whatever) into a given paper size (e.g. A5 landscape).

I already have that implemented, with a map on a webpage, and setting the boundary on the max/min lat/lon values of the polygon. However, I have the following problems: 1) Because the polygon may be large, the zoom level chosen may be low, so the map omits street names, but I absolutely need all street names. Printing has 600+ dpi, so it should be fine. 2) OpenLayers calculates with the 100dpi of the screen, and choses the zoom level accordingly, but the printer has 600dpi, and the curved street names look pixelish coarse, ugly and barely readable. 3) the zoom levels are in fixed steps, so the resulting map has a lot of unneeded area around the area I actually want. The size is given, so the wanted area is unnecessarily small. 4) the wanted area is not necessarily parallel to lat/lon axis, so if I have an area that's high, and a paper that's wide, there's even more unused space left and right.

Unless somebody has a better suggestion (that involves only OpenLayers, not any server), I am thinking of the following approach:

1. Let OpenLayers render the map (the whole map, not just one vector
   layer) into an off-screen <canvas> element, and make a bitmap of it.
2. Set the zoom level to a certain minimum (e.g. 17), where all street
   names are shown. The result would be a map that is huge, but it's in
   a bitmap, not on the webpage.
3. Given the shape of the polygon, I rotate the bitmap so that the
   polygon uses as much of the available print rectangle (e.g. 20:15)
   as possible.
4. Scale down the (rotated) bitmap so that I end up with one that has
   20x15 cm at 600 dpi (= 236 dots per cm) = 4720x3540 px


I think I could do step 3. and 4., but I don't know how to do 1. (and 2).

Ben

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to