[OpenLayers-Users] scale vs resolution

Christopher Schmidt crschmidt at metacarta.com
Fri Jan 18 17:29:31 EST 2008


On Fri, Jan 18, 2008 at 01:14:03PM -0800, James McManus wrote:
> Is resolution (map units per pixel) in OpenLayers that same as a map scale? 

No. Scale is a false claim of 'screen units per on-the-ground units":
1:19000 (supposedly) means 1 inch on screen = 19000 inches on the
ground.

This isn't true, of course: there is an implicit assumption that the
server knows how many pixels there are in an inch on the screen, which
it can't, since screens change resolution. A 256 pixel wide image on the
screen at 800x600 is way larger than at 1600x1200.

So, it's based on the guess of 72DPI (in MapServer -- in GeoServer it
matches the SLD standard at 90.something DPI). 

To get resolution from scale, use
OpenLayers.Util.getResolutionFromScale(19000, map_units), where
map_units is one of 'inches', 'mi', 'm', 'km', 'dd', 'yd', 'nmi', 'ft'. 
 
Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list