In fact, there are two examples of ArcGIS API for JavaScript, but there are some parameters that are not clearly explained. An example of ArcGIS is a service published by GeoServer as an example, and here is an independent Geowebcache service WMTS service, the address is HTTP://LOCALHOST:8080/GEOWEBCACHE/SERVICE/WMTS, The example given by ArcGIS has not been tuned for two days, as in the following example (which I have changed):
<script>
var map, Wmtslayer;
Require ([
"Esri/map", "Esri/layers/wmtslayer", "Esri/layers/wmtslayerinfo",
"Esri/geometry/extent", "Esri/layers/tileinfo", "Esri/spatialreference",
"Dojo/parser",
"Dijit/layout/bordercontainer", "Dijit/layout/contentpane", "dojo/domready!"
], function (
Map, Wmtslayer, Wmtslayerinfo,
Extent, Tileinfo, Spatialreference,
Parser
) {
Parser.parse ();
Map = new Map ("map", {
Logo:false
});
var tileInfo1 = new Tileinfo ({
"DPI": 96,
"Format": "Image/png",
"CompressionQuality": 0,
"Spatialreference": New Spatialreference ({
"Wkid": 3857
}),
"Rows": 256,
"Cols": 256,
"Origin": {
"X":-20037508.342787001,
"Y": 20037508.342787001
},
"LODs": [{
"Level": "epsg:3857_arcgisservercn:0",
"Scale": 591657527.591555,
"Resolution": 156543.03392800014
}, {
"Level": "Epsg:3857_arcgisservercn:1",
"Scale": 295828763.79577702,
"Resolution": 78271.516963999937
}, {
"Level": "Epsg:3857_arcgisservercn:2",
"Scale": 147914381.89788899,
"Resolution": 39135.758482000092
}, {
"Level": "Epsg:3857_arcgisservercn:3",
"Scale": 73957190.948944002,
"Resolution": 19567.879240999919
}, {
"Level": "Epsg:3857_arcgisservercn:4",
"Scale": 36978595.474472001,
"Resolution": 9783.9396204999593
}, {
"Level": "Epsg:3857_arcgisservercn:5",
"Scale": 18489297.737236001,
"Resolution": 4891.9698102499797
}, {
"Level": "Epsg:3857_arcgisservercn:6",
"Scale": 9244648.8686180003,
"Resolution": 2445.9849051249898
}, {
"Level": "Epsg:3857_arcgisservercn:7",
"Scale": 4622324.4343090001,
"Resolution": 1222.9924525624949
}, {
"Level": "Epsg:3857_arcgisservercn:8",
"Scale": 2311162.2171550002,
"Resolution": 611.49622628137968
}, {
"Level": "Epsg:3857_arcgisservercn:9",
"Scale": 1155581.108577,
"Resolution": 305.74811314055756
}]
});
var tileExtent1 = new Extent (15458931.4659706, 2701989.00905778, 15477712.7689042, 2711695.89036901, new Spatialreference ({
wkid:3857
//}));
var tileExtent1 = new Extent (13507034.394216927, 3656747.4331628317, 13519570.066855695, 3665308.3803307717, new Spatialreference ({
wkid:3857
}));
var layerInfo1 = new Wmtslayerinfo ({
Tileinfo:tileinfo1,
Fullextent:tileextent1,
Initialextent:tileextent1,
Identifier: "ARCGISSERVERCN",
Tilematrixset: "epsg:3857_arcgisservercn",
Format: "JPEG",
Style: "_null"
});
var resourceinfo = {
Version: "1.0.0",
Layerinfos: [LayerInfo1],
Copyright: "Open Layer"
};
var options = {
Servicemode: "KVP",
Resourceinfo:resourceinfo,
Layerinfo:layerinfo1
};
Wmtslayer = new Wmtslayer ("Http://localhost:8080/geowebcache/service/wmts", options);
Map.addlayer (Wmtslayer);
});
</script>
In fact, TileInfo1 dpi, format and other parameters for the independent Geowebcache released services do not have any role, mainly red places need to pay attention to the release of the service grids sets, rather than a simple epsg:3857.
ArcGIS API for JavaScript load standalone Geowebcache published WMTS service