summaryrefslogtreecommitdiff
path: root/misc/openlayers/examples/fractional-zoom.html
blob: b01c2d6611439565c3d2156c9c2f6be3c787d210 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
    <link rel="stylesheet" href="style.css" type="text/css">
    <script src="../lib/OpenLayers.js"></script>
    <script type="text/javascript">
        var map;

        function init() {
            map = new OpenLayers.Map('map', 
                 {controls: [new OpenLayers.Control.Navigation(), 
                             new OpenLayers.Control.PanZoomBar()], 
                  numZoomLevels: 10 });
            var wms = new OpenLayers.Layer.WMS(
                "OpenLayers WMS",
                "http://vmap0.tiles.osgeo.org/wms/vmap0",
                {layers: 'basic'}
            );
            map.addLayers([wms]);

            map.events.register("moveend", null, displayZoom);

            map.zoomToMaxExtent();
            
            update(document.getElementById("fractional"));
            
        }
        
        function displayZoom() {
            document.getElementById("zoom").innerHTML = map.zoom.toFixed(4);
        }
        
        function update(input) {
            map.fractionalZoom = input.checked;
            map.zoomTo(Math.round(map.zoom));
        }
    </script>
  </head>
  <body onload="init()">
    <h1 id="title">Fractional Zoom Example</h1>

    <div id="tags">
        zoomlevel, unlimited zoom, scale
    </div>
    <p id="shortdesc">
            Shows the use of a map with fractional (or non-discrete) zoom levels.
    </p>

    <div id="map" class="smallmap"></div>
        <input type="checkbox" name="fractional"
               id="fractional" checked="checked" onclick="update(this)" />
        <label for="fractional">Fractional Zoom</label>
        (zoom: <span id="zoom"></span>)
        <br><br>
    <div id="docs">
            <p>
            Setting the map.fractionalZoom property to true allows zooming to
            an arbitrary level (between the min and max resolutions).  This
            can be demonstrated by shift-dragging a box to zoom to an arbitrary
            extent.
            </p>
    </div>
  </body>
</html>