[OpenLayers-Users] scaleline in lon/lat projection

Jan jab at umk.pl
Wed Apr 28 07:33:12 EDT 2010


Hi all,
It seems that in lon/lat projections (e.g. EPSG 4326) the scale line is
right only for the Equator (0 lat).
If you look at the map, e.g.:
http://dev.openlayers.org/addins/scalebar/trunk/examples/scalebar.html the
scaleline stays constant even if you pan map from N to S. It seems that
Poland for example has a width of 1000 km (W-E), while in fact it has
approx. 600 km. This is just wrong and for "spatially-unaware" users it will
give wrong information.

AFAIK scale bar's width can be adjusted using:

OpenLayers.INCHES_PER_UNIT["degrees"] = x;

where x can be calculated using the length of a given parallel (in inches)
divided by 360 degrees. The default inch per unit value is 4374754.
4374754 * 360 degrees = 1574911440 inches = 40000 km (the length of the
Equator).

It would be nice to implement a default functionality in OL for automatic
adjustments of INCHES_PER_UNIT value based e.g. on the latitude of a map
center (for example using moveend or zoomend map events). In this way, the
scale bar would be always correct at least in the center of the map. If you
create a map for higher latitudes it is crucial. The wrong scale line I
would call even a bug (imagine using this scaleline in northern Canada or
Norway).

By the way, it seems that Google Maps uses this method to correct the scale
line (check http://maps.google.com, pan the map in N/S direction and see how
the scale line adjusts without changing the scale of the map).

Best regards to all OL users,
Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100428/a1b74a24/attachment.html


More information about the Users mailing list