1 | <!DOCTYPE html> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <title>ArcGIS Server Map Cache Example (Direct Access)</title> |
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
---|
6 | <link rel="stylesheet" href="../theme/default/style.css" type="text/css"> |
---|
7 | <link rel="stylesheet" href="style.css" type="text/css"> |
---|
8 | <script src="../lib/OpenLayers.js" type="text/javascript"></script> |
---|
9 | <script src="../lib/OpenLayers/Layer/ArcGISCache.js" type="text/javascript"></script> |
---|
10 | <script type="text/javascript"> |
---|
11 | /* First 4 variables extracted from conf.xml file */ |
---|
12 | |
---|
13 | /* Tile layers & map MUST have same projection */ |
---|
14 | var proj='EPSG:26915'; |
---|
15 | |
---|
16 | |
---|
17 | /* Layer can also accept serverResolutions array |
---|
18 | * to deal with situation in which layer resolution array & map resolution |
---|
19 | * array are out of sync*/ |
---|
20 | var mapResolutions = [33.0729828126323,16.9333672000677,8.46668360003387,4.23334180001693,2.11667090000847,1.05833545000423]; |
---|
21 | |
---|
22 | /* For this example this next line is not really needed, 256x256 is default. |
---|
23 | * However, you would need to change this if your layer had different tile sizes */ |
---|
24 | var tileSize = new OpenLayers.Size(256,256); |
---|
25 | |
---|
26 | /* Tile Origin is required unless it is the same as the implicit map origin |
---|
27 | * which can be affected by several variables including maxExtent for map or base layer */ |
---|
28 | var agsTileOrigin = new OpenLayers.LonLat(-5120900,9998100); |
---|
29 | |
---|
30 | /* This can really be any valid bounds that the map would reasonably be within */ |
---|
31 | /* var mapExtent = new OpenLayers.Bounds(293449.454286,4307691.661132,314827.830376,4323381.484178); */ |
---|
32 | var mapExtent = new OpenLayers.Bounds(289310.8204,4300021.937,314710.8712,4325421.988); |
---|
33 | |
---|
34 | var aerialsUrl = 'http://serverx.esri.com/arcgiscache/dgaerials/Layers/_alllayers'; |
---|
35 | var roadsUrl = 'http://serverx.esri.com/arcgiscache/DG_County_roads_yesA_backgroundDark/Layers/_alllayers'; |
---|
36 | |
---|
37 | var map; |
---|
38 | function init(){ |
---|
39 | map = new OpenLayers.Map('map', { |
---|
40 | maxExtent:mapExtent, |
---|
41 | controls: [ |
---|
42 | new OpenLayers.Control.Navigation(), |
---|
43 | new OpenLayers.Control.LayerSwitcher(), |
---|
44 | new OpenLayers.Control.PanZoomBar(), |
---|
45 | new OpenLayers.Control.MousePosition()] |
---|
46 | }); |
---|
47 | |
---|
48 | var baseLayer = new OpenLayers.Layer.ArcGISCache('Aerials', aerialsUrl, { |
---|
49 | tileOrigin: agsTileOrigin, |
---|
50 | resolutions: mapResolutions, |
---|
51 | sphericalMercator: true, |
---|
52 | maxExtent: mapExtent, |
---|
53 | useArcGISServer: false, |
---|
54 | isBaseLayer: true, |
---|
55 | type: 'jpg', |
---|
56 | projection: proj |
---|
57 | }); |
---|
58 | var overlayLayer = new OpenLayers.Layer.ArcGISCache('Roads', roadsUrl, { |
---|
59 | tileOrigin: agsTileOrigin, |
---|
60 | resolutions: mapResolutions, |
---|
61 | sphericalMercator: true, |
---|
62 | maxExtent: mapExtent, |
---|
63 | useArcGISServer: false, |
---|
64 | isBaseLayer: false, |
---|
65 | projection: proj |
---|
66 | }); |
---|
67 | map.addLayers([baseLayer, overlayLayer]); |
---|
68 | |
---|
69 | //map.zoomToExtent(new OpenLayers.Bounds(295892.34, 4308521.69, 312825.71, 4316988.37)); |
---|
70 | map.zoomToExtent(new OpenLayers.Bounds(-8341644, 4711236, -8339198, 4712459)); |
---|
71 | } |
---|
72 | </script> |
---|
73 | </head> |
---|
74 | <body onload="init()"> |
---|
75 | <h1 id="title">ArcGIS Server Map Cache Example (Direct Access)</h1> |
---|
76 | |
---|
77 | <div id="tags"> |
---|
78 | </div> |
---|
79 | |
---|
80 | <p id="shortdesc"> |
---|
81 | Demonstrates the basic initialization of the ArcGIS Cache layer using a prebuilt configuration, and direct tile access from a file store. |
---|
82 | </p> |
---|
83 | |
---|
84 | <div id="map" class="smallmap"></div> |
---|
85 | |
---|
86 | <div id="docs"> |
---|
87 | <p>This example demonstrates using the ArcGISCache layer for |
---|
88 | accessing ESRI's ArcGIS Server (AGS) Map Cache tiles directly |
---|
89 | via the folder structure and HTTP. Toggle the visibility of the AGS layer to |
---|
90 | demonstrate how the two maps are lined up correctly.</p> |
---|
91 | |
---|
92 | <h2>Notes on this Layer</h2> |
---|
93 | <p>It's important that you set the correct values in your layer, and these |
---|
94 | values will differ between tile sets. You can find these values for your |
---|
95 | layer in conf.xml at the root of your cache. |
---|
96 | (ie. <a href="http://serverx.esri.com/arcgiscache/dgaerials/Layers/conf.xml">http://serverx.esri.com/arcgiscache/dgaerials/Layers/conf.xml</a>)</p> |
---|
97 | |
---|
98 | <p>For fused map caches this is often http:<i>ServerName</i>/arcgiscache/<i>MapServiceName</i>/Layers <br> |
---|
99 | For individual layer caches this is often http:<i>ServerName</i>/arcgiscache/<i>LayerName</i>/Layers </p> |
---|
100 | |
---|
101 | <h2> Other Examples </h2> |
---|
102 | <p>This is one of three examples for this layer. You can also configure this |
---|
103 | layer to use <a href="arcgiscache_ags.html">prebuilt tiles from a live server.</a> It is also |
---|
104 | 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> |
---|
105 | </p> |
---|
106 | </div> |
---|
107 | </body> |
---|
108 | </html> |
---|