[OpenLayers-Users] Calculate the scale of the map in a printing size

Pedro Simonetti Garcia pedrosimonetti at gmail.com
Mon Apr 21 03:16:26 EDT 2008


Hi everybody,

I'm not sure if this mailing is the right place to ask, so If this is the
not the right one, please point me a proper list to do it.

I'm developing a printing system in PHP Mapscript, and I'm dealing with the
well known "symbols and fonts size after resizing the map" problem. I've
researched in different mailing list, but I didn't find a working solution.
Someone pointed that it might be possible to automatically look for mapfile
elements and resize them with Mapscript. I'm working on this approach.

With this approach I'm getting good results. But now, I need to calculate
the scale of the map in 2 different sizes: 1) the scale of the map with the
viewport's size, and 2) the scale of the map with the printing size.

With OpenLayers, the scale at viewport's size is not problem, once I can get
this value with map.getScale(). But, how do I calculate the scale of the
same map, but with a different size?

To make it easy to understand, let's suppose I have a 800x600 map viewport,
and I wanna print this same map with 288 dpi. Since 72dpi is the base value
of mapserver, 288dpi = 4 * 72 dpi. So the printing size will be 800*4 x
600*4 = 3200 x 2400. The basic scale value I can get from map.getScale().
But how do I calculate the scale of this map with a 3200 x 2400 size?

I need to work with this value in Mapscript so the symbols and fonts can be
properly resized at different sizes/resolutions. The value will be around
map.getScale() / 4, but this is not the precise value, and it could lead to
some precision errors.

thanks in advance,

Pedro Simonetti.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080421/abfe1cd7/attachment.html


More information about the Users mailing list