[OpenLayers-Users] scalebars

Andreas Hocevar ahocevar at opengeo.org
Wed Jul 20 06:34:39 EDT 2011


Robert,

Haven't you read and understood
http://docs.openlayers.org/library/spherical_mercator.html? Looking at
a screen of unknown resolution (DPI), wouldn't you agree that scales
are ridiculous in the first place? In web mapping, the resolution is a
more suitable concept. It's the approximate extent of a screen pixel
in map units. Now if you look at the resolutions array instead of the
scales, you'll see that these always divide by 2 from one zoom level
to the next, and that zoom level 0 is the Web Mercator world
(20037508.34 * 2 meters by 20037508.34 * 2 meters) on a 256x256 pixel
tile, so 156543.03390625 meters per pixel. Do the figures here ring a
bell?

Andreas.

On Tue, Jul 19, 2011 at 9:48 PM, Robert Buckley
<robertdbuckley at yahoo.com> wrote:
> Hi,
> I am still having problems understanding scales and spherical mercator. Is
> it possible to define the map scales so that they are not rediculous
> numbers. In my app it is not working.
>
> http://maps.zgb.de/www/eeg/search.html
>
> var map = new OpenLayers.Map("map",{
> projection:epsg3857,
>         displayProjection: epsg4326,
>         units: "m",
> scales: [1000000, 500000, 100000, 50000, 25000, 10000, 5000, 1000],
> maxExtent: new OpenLayers.Bounds(-20037508, -20037508,20037508, 20037508),
> restrictedExtent: new OpenLayers.Bounds(946290.410001, 6707196.356766,
> 1368222.80606, 6965247.764211),
>         controls: [new OpenLayers.Control.MouseDefaults()
> ,new OpenLayers.Control.PanZoomBar()
> ,new OpenLayers.Control.MousePosition()
> ,new OpenLayers.Control.ScaleLine({geodesic: true})]
>     });
>
> thanks for any tips,
> Rob
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list