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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
| <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>OpenGeo WMTS Service</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.18/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="https://js.arcgis.com/3.18/esri/css/esri.css"> <style> html, body, #map { height: 100%; margin: 0; padding: 0; } </style> <script src="https://js.arcgis.com/3.18/"></script> <script> require([ "dojo/_base/declare", "esri/map", "esri/layers/WMTSLayer", "esri/layers/TiledMapServiceLayer", "esri/geometry/Extent", "esri/SpatialReference", "esri/layers/TileInfo", "dojo/domReady!" ], function (declare, Map, WMTSLayer, TiledMapServiceLayer, Extent, SpatialReference, TileInfo){
var CustomWMTSLayer = declare([TiledMapServiceLayer], { declaredClass: "ogc.WMTSLayer", constructor: function (){ this.copyright = '<a href="http://v2.suite.opengeo.org/geoserver/gwc/service/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetCapabilities">WMTS</a> served by <a href="http://opengeo.org/">OpenGeo</a>'; this.version = "1.0.0"; this.identifier = "img states"; this.imageFormat = "image/png"; this.tileMatrixSet = "EPSG:4326"; this.spatialReference = new SpatialReference({wkid: 4326}); this.initialExtent = new Extent(-180.0,-90.0,180.0,90.0, this.spatialReference); this.fullExtent = new Extent(-180.0,-90.0,180.0,90.0, this.spatialReference); this.tileInfo = new TileInfo({ "dpi": "90.71428571427429", "format": "image/png", "compressionQuality": 0, "spatialReference": { "wkid": "4326" }, "rows": 256, "cols": 256, "origin": { "x": -180.0, "y": 90.0 },
"lods": [ { "level": 0, "resolution": 0.703125, "scale": 295497593.05875 },
{ "level": 1, "resolution": 0.3515625, "scale": 147748796.529375 },
{ "level": 2, "resolution": 0.17578125, "scale": 73874398.264688 },
{ "level": 3, "resolution": 0.087890625, "scale": 36937199.132344 },
{ "level": 4, "resolution": 0.0439453125, "scale": 18468599.566172 },
{ "level": 5, "resolution": 0.02197265625, "scale": 9234299.783086 },
{ "level": 6, "resolution": 0.010986328125, "scale": 4617149.891543 },
{ "level": 7, "resolution": 0.0054931640625, "scale": 2308574.945771 },
{ "level": 8, "resolution": 0.00274658203125, "scale": 1154287.472886 },
{ "level": 9, "resolution": 0.001373291015625, "scale": 577143.736443 },
{ "level": 10, "resolution": 0.0006866455078125, "scale": 288571.86822143558 },
{ "level": 11, "resolution": 0.00034332275390625, "scale": 144285.93411071779 },
{ "level": 12, "resolution": 0.000171661376953125, "scale": 72142.967055358895 },
{ "level": 13, "resolution": 8.58306884765625e-005, "scale": 36071.483527679447 },
{ "level": 14, "resolution": 4.291534423828125e-005, "scale": 18035.741763839724 },
{ "level": 15, "resolution": 2.1457672119140625e-005, "scale": 9017.8708819198619 },
{ "level": 16, "resolution": 1.0728836059570313e-005, "scale": 4508.9354409599309 },
{ "level": 17, "resolution": 5.3644180297851563e-006, "scale": 2254.4677204799655 }] });
this.loaded = true;
this.onLoad(this); },
getTileUrl: function (level, row, col) { var levelMap = ""; levelMap = "http://localhost:8080/geowebcache/service/wmts" + "?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile"
+ "&LAYER=img states" + "&STYLE=_null" + "&FORMAT=image/png" + "&TILEMATRIXSET=EPSG:4326"
+ "&TILEMATRIX=EPSG:4326:" + level + "&TILEROW=" + row + "&TILECOL=" + col; return levelMap; } });
var map = new Map("map", { center: [-97.19961,33.15156], zoom: 5 });
var customWMTSLayer = new CustomWMTSLayer(); map.addLayer(customWMTSLayer); }); </script> </head> <body class="claro"> <div id="map"></div> </body> </html>
|