[OSM-newbies] Scale in maps?

Andy Allan gravitystorm at gmail.com
Thu Nov 18 09:35:20 GMT 2010


On Wed, Nov 17, 2010 at 7:52 PM, Stephen Cavilia <ailivac at gmail.com> wrote:
> Cool! And it even adjusts correctly when you pan the mercator projection
> north to south. I wonder if this is some new code specific to the OSM
> site or a new OpenLayers release. I've been looking for a scale bar
> control that works for more projections in general rather than just
> trivial cases like TM for some of my own projects.

It's getting a bit technical for the newbies list, but the
self-adjusting scale bar was introduced in OpenLayers 2.10 . The patch
to include it in openstreetmap was pretty trivial:

https://github.com/openstreetmap/openstreetmap-website/commit/624453948e4d69387793577a77b080a2ddca2858

The documentation suggests that it uses the horizontal size of the
pixel in the middle of the screen, so I don't think it's Spherical
Mercator specific.

http://dev.openlayers.org/releases/OpenLayers-2.10/doc/apidocs/files/OpenLayers/Control/ScaleLine-js.html

Like I said, further techy discussion would be better off on
dev at openstreetmap.org

Cheers,
Andy



More information about the newbies mailing list