[OpenLayers-Users] Openlayers 2.6 - zoomLevels.html
Linda Rawson
linda.rawson at gmail.com
Thu Apr 3 12:18:45 EDT 2008
Here is the example. Yours with two extra scales.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OpenLayers Basic Single WMS Example</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
<style type="text/css">
#map {
width: 512px;
height: 512px;
border: 1px solid black;
}
</style>
<script src="http://openlayers.org/api/2.6-rc1/OpenLayers.js"></script>
<script type="text/javascript">
var map, layer;
function init(){
map = new OpenLayers.Map( 'map',
{scales:[50000000, 30000000, 20000000, 10000000],
controls: [new OpenLayers.Control.PanZoomBar()]} );
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0",
{layers: 'basic'} );
map.addLayer(layer);
map.zoomToMaxExtent();
}
</script>
</head>
<body onload="init()">
<h1 id="title">Basic Single WMS Example</h1>
<div id="tags"></div>
<div id="shortdesc">Show a Simple Map</div>
<div id="map"></div>
<div id="docs">
This example shows a very simple layout with minimal controls.
This example uses a single WMS base layer.
</div>
</body>
</html>
Try clicking on the third zoom level. It does nothing. Then you
click on the second and the zoom goes to the third. It is off by one
every time. Then go the other direction. More havoc.
Linda
On Thu, Apr 3, 2008 at 10:04 AM, Christopher Schmidt
<crschmidt at metacarta.com> wrote:
>
> On Thu, Apr 03, 2008 at 09:39:23AM -0600, Linda Rawson wrote:
> > I found the problem. Somebody changed this line in PanZoomBar.js
> >
> > FROM:
> >
> > var levels = Math.floor((y - top)/this.zoomStopHeight);
> >
> > TO:
> >
> > var levels = (y - top)/this.zoomStopHeight;
> >
> > This is causing the problem.
>
> Math.floor is called (if your map doesn't have fractionalZoom) two lines
> later, on the zoom. Can you explain why this is a problem in your setup?
>
> A more complete HTML example with the behavior you expect and the
> behavior you're getting would be helpful.
>
> Regards,
> --
> Christopher Schmidt
> MetaCarta
>
--
Linda Rawson
More information about the Users
mailing list