summaryrefslogtreecommitdiff
path: root/misc/openlayers/examples/arcgiscache_direct.html
blob: 472a48014a94844cbd91c5703b63b5b0313c5e20 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html>
<html>
    <head>
        <title>ArcGIS Server Map Cache Example (Direct Access)</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <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" type="text/javascript"></script>
        <script src="../lib/OpenLayers/Layer/ArcGISCache.js" type="text/javascript"></script>
        <script type="text/javascript">
        /* First 4 variables extracted from conf.xml file */
        
            /* Tile layers & map MUST have same projection */
            var proj='EPSG:26915';
        
        
            /* Layer can also accept serverResolutions array
             * to deal with situation in which layer resolution array & map resolution
             * array are out of sync*/
            var mapResolutions = [33.0729828126323,16.9333672000677,8.46668360003387,4.23334180001693,2.11667090000847,1.05833545000423];

            /* For this example this next line is not really needed, 256x256 is default.
             * However, you would need to change this if your layer had different tile sizes */
            var tileSize = new OpenLayers.Size(256,256);
            
            /* Tile Origin is required unless it is the same as the implicit map origin
             * which can be affected by several variables including maxExtent for map or base layer */
            var agsTileOrigin = new OpenLayers.LonLat(-5120900,9998100);
            
            /* This can really be any valid bounds that the map would reasonably be within */
            /*  var mapExtent = new OpenLayers.Bounds(293449.454286,4307691.661132,314827.830376,4323381.484178); */
            var mapExtent = new OpenLayers.Bounds(289310.8204,4300021.937,314710.8712,4325421.988);
            
            var aerialsUrl = 'http://serverx.esri.com/arcgiscache/dgaerials/Layers/_alllayers';
            var roadsUrl = 'http://serverx.esri.com/arcgiscache/DG_County_roads_yesA_backgroundDark/Layers/_alllayers';
            
            var map;
            function init(){
                map = new OpenLayers.Map('map', {
                    maxExtent:mapExtent,
                    controls: [
                        new OpenLayers.Control.Navigation(),
                        new OpenLayers.Control.LayerSwitcher(), 
                        new OpenLayers.Control.PanZoomBar(),
                        new OpenLayers.Control.MousePosition()]
                });
                
                var baseLayer = new OpenLayers.Layer.ArcGISCache('Aerials', aerialsUrl, {
                    tileOrigin: agsTileOrigin,
                    resolutions: mapResolutions,
                    sphericalMercator: true,
                    maxExtent: mapExtent,
                    useArcGISServer: false,
                    isBaseLayer: true,
                    type: 'jpg',
                    projection: proj
                });
                var overlayLayer = new OpenLayers.Layer.ArcGISCache('Roads', roadsUrl, {
                    tileOrigin: agsTileOrigin,
                    resolutions: mapResolutions,
                    sphericalMercator: true,
                    maxExtent: mapExtent,
                    useArcGISServer: false,
                    isBaseLayer: false,
                    projection: proj
                });
                map.addLayers([baseLayer, overlayLayer]);
                
                //map.zoomToExtent(new OpenLayers.Bounds(295892.34, 4308521.69, 312825.71, 4316988.37));
                map.zoomToExtent(new OpenLayers.Bounds(-8341644, 4711236, -8339198, 4712459));
            }
        </script>
    </head>
    <body onload="init()">
        <h1 id="title">ArcGIS Server Map Cache Example (Direct Access)</h1>

        <div id="tags">
        </div>

        <p id="shortdesc">
            Demonstrates the basic initialization of the ArcGIS Cache layer using a prebuilt configuration, and direct tile access from a file store.
        </p>

        <div id="map" class="smallmap"></div>
        
        <div id="docs">
            <p>This example demonstrates using the ArcGISCache layer for 
            accessing ESRI's ArcGIS Server (AGS) Map Cache tiles directly 
            via the folder structure and HTTP.  Toggle the visibility of the AGS layer to
            demonstrate how the two maps are lined up correctly.</p>

            <h2>Notes on this Layer</h2>
            <p>It's important that you set the correct values in your layer, and these
            values will differ between tile sets. You can find these values for your 
            layer in conf.xml at the root of your cache. 
            (ie. <a href="http://serverx.esri.com/arcgiscache/dgaerials/Layers/conf.xml">http://serverx.esri.com/arcgiscache/dgaerials/Layers/conf.xml</a>)</p>

            <p>For fused map caches this is often http:<i>ServerName</i>/arcgiscache/<i>MapServiceName</i>/Layers <br>
            For individual layer caches this is often  http:<i>ServerName</i>/arcgiscache/<i>LayerName</i>/Layers </p>
            
            <h2> Other Examples </h2>
            <p>This is one of three examples for this layer.  You can also configure this
            layer to use <a href="arcgiscache_ags.html">prebuilt tiles from a live server.</a> It is also
            possible to let this <a href="arcgiscache_jsonp.html">layer 'auto-configure' itself using the capabilities json object from the server itself when using a live ArcGIS server.</a>
            </p>
        </div>
    </body>
</html>