[OpenLayers-Users] Can I constrain a map to a certain scale in pixels/km?

Nick Whitelegg nick at hogweed.org
Thu Jan 25 16:31:17 EST 2007


On Wednesday 24 Jan 2007 23:47, you wrote:
> On Wed, Jan 24, 2007 at 11:19:25PM +0000, Nick Whitelegg wrote:
> > I'm developing a "slippy map" based on OpenStreetMap with SRTM contours.
> > I have pre-generated a set of 500x500 tiles of scale 100 pixels/km using
> > Mapnik. My maps are in OSGB projection: the bounding box requests are in
> > metre units.
> >
> > With OpenLayers am I able to constrain the map to a certain number of
> > pixels/km e.g. either 100 or 200 (they are the scales I intend to
> > support)?
>
> Sure. Turn that into map units per pixel (100/1000 -> .1, iiuc), and
> then send a 'resolutions' param in the map options. More info at
> http://trac.openlayers.org/wiki/SettingZoomLevels
>
> Regards,

Hello Chris,

OK thanks - that worked :-)
Surprisingly the resolution required was 10, which is neither pixels/km (100) 
or pixels/m (.1).

Nick



More information about the Users mailing list