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

Christopher Schmidt crschmidt at metacarta.com
Thu Jan 25 17:06:59 EST 2007


On Thu, Jan 25, 2007 at 09:31:17PM +0000, Nick Whitelegg wrote:
> 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).

Right, sorry, I misspoke. "resolution" is 'map units per pixel', so it
should be m/pixel, which is 1000m/100px, 10 m/p.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list