Select to view content in your preferred language

WMTS layer is offset from others layers

1462
0
08-25-2011 06:18 AM
PauPérez_Puigcerver
Emerging Contributor
I configured a WMTS layer with GeoWebCache, reading a WMS output of my organization.

The WMTS service is public:

http://cartoweb.cma.gva.es/geowebcache/service/wmts

The layer is Ortofoto_ICV.

When I put the layer as a custom Layer (WMTS), the layer is viewed properly (image:wmts_perso_layer.jpg)

And the code for the layer properties:

dojo.declare("ogc.WMTSLayer_Orto", esri.layers.TiledMapServiceLayer, { // create WMTSLayer by extending esri.layers.TiledMapServiceLayer
constructor: function() {
this.spatialReference = new esri.SpatialReference({wkid: 25830});
this.initialExtent = new esri.geometry.Extent(400000, 4100000, 1100000, 4600000, this.spatialReference);
this.fullExtent = new esri.geometry.Extent(400000, 4100000, 1100000, 4600000, this.spatialReference);
//
this.tileInfo = new esri.layers.TileInfo({
"dpi": "96",
"format": "image/jpeg",
"compressionQuality": 0,
"spatialReference": {"wkid": "25830"},
"rows": 200,
"cols": 200,
"origin": {
"x": 400000,
"y": 4600000
},
"lods":[{"level": "EPSG:25830:0","scale": 2200000,"resolution": 582.08449750232842},
{"level": "EPSG:25830:1","scale": 1600000,"resolution": 423.33418000169337},
{"level": "EPSG:25830:2","scale": 1000000,"resolution": 264.58386250105838},
{"level": "EPSG:25830:3","scale": 800000,"resolution": 211.66709000084668},
{"level": "EPSG:25830:4","scale": 600000,"resolution": 158.75031750063502},
{"level": "EPSG:25830:5","scale": 500000,"resolution": 132.29193125052919},
{"level": "EPSG:25830:6","scale": 400000,"resolution": 105.83354500042334},
{"level": "EPSG:25830:7","scale": 300000,"resolution": 79.375158750317510},
{"level": "EPSG:25830:8","scale": 250000,"resolution": 66.145965625264594},
{"level": "EPSG:25830:9","scale": 200000,"resolution": 52.916772500211671},
{"level": "EPSG:25830:10","scale": 150000,"resolution": 39.687579375158755},
{"level": "EPSG:25830:11","scale": 125000,"resolution": 33.072982812632297},
{"level": "EPSG:25830:12","scale": 100000,"resolution": 26.458386250105836},
{"level": "EPSG:25830:13","scale": 90000,"resolution": 23.812547625095252},
{"level": "EPSG:25830:14","scale": 80000,"resolution": 21.166709000084669},
{"level": "EPSG:25830:15","scale": 70000,"resolution": 18.520870375074086},
{"level": "EPSG:25830:16","scale": 60000,"resolution": 15.875031750063501},
{"level": "EPSG:25830:17","scale": 50000,"resolution": 13.229193125052918},
{"level": "EPSG:25830:18","scale": 40000,"resolution": 10.583354500042335},
{"level": "EPSG:25830:19","scale": 30000,"resolution": 7.9375158750317505},
{"level": "EPSG:25830:20","scale": 25000,"resolution": 6.6145965625264589},
{"level": "EPSG:25830:21","scale": 20000,"resolution": 5.2916772500211673},
{"level": "EPSG:25830:22","scale": 15000,"resolution": 3.9687579375158752},
{"level": "EPSG:25830:23","scale": 12500,"resolution": 3.3072982812632294},
{"level": "EPSG:25830:24","scale": 10000,"resolution": 2.6458386250105836},
{"level": "EPSG:25830:25","scale": 7500,"resolution": 1.9843789687579376},
{"level": "EPSG:25830:26","scale": 5000,"resolution": 1.322919312505290},
{"level": "EPSG:25830:27","scale": 3000,"resolution": 0.793751587503175},
{"level": "EPSG:25830:28","scale": 2000,"resolution": 0.529167725002117},
{"level": "EPSG:25830:29","scale": 1000,"resolution": 0.264583862501058},
{"level": "EPSG:25830:30","scale": 500,"resolution": 0.132291931250529}]
});
this.loaded = true;
this.onLoad(this);
},

getTileUrl: function(level, row, col) {
return "http://cartoweb.cma.gva.es/geowebcache/service/wmts" + "?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile" + "&LAYER=Ortofoto_ICV" + "&STYLE=_null" + "&FORMAT=image/jpeg" + "&TILEMATRIXSET=EPSG:25830" + "&TILEMATRIX=" + level + "&TILEROW=" + row + "&TILECOL=" + col;
}
});



But If I put the layer as a WMTS Layer, the image have an offset (see image: wmts_layer.jpg) with the same settings.

The code is:

var tileInfo1 = new esri.layers.TileInfo({
"dpi": "96",
"format": "image/jpeg",
"compressionQuality": 0,
"spatialReference": new esri.SpatialReference({"wkid": 25830}),
"height": 200,
"width": 200,
"origin": {
"x": 400000,
"y": 4600000
},
"lods":[{"level": "EPSG:25830:0","scale": 2200000,"resolution": 582.08449750232842},
{"level": "EPSG:25830:1","scale": 1600000,"resolution": 423.33418000169337},
{"level": "EPSG:25830:2","scale": 1000000,"resolution": 264.58386250105838},
{"level": "EPSG:25830:3","scale": 800000,"resolution": 211.66709000084668},
{"level": "EPSG:25830:4","scale": 600000,"resolution": 158.75031750063502},
{"level": "EPSG:25830:5","scale": 500000,"resolution": 132.29193125052919},
{"level": "EPSG:25830:6","scale": 400000,"resolution": 105.83354500042334},
{"level": "EPSG:25830:7","scale": 300000,"resolution": 79.375158750317510},
{"level": "EPSG:25830:8","scale": 250000,"resolution": 66.145965625264594},
{"level": "EPSG:25830:9","scale": 200000,"resolution": 52.916772500211671},
{"level": "EPSG:25830:10","scale": 150000,"resolution": 39.687579375158755},
{"level": "EPSG:25830:11","scale": 125000,"resolution": 33.072982812632297},
{"level": "EPSG:25830:12","scale": 100000,"resolution": 26.458386250105836},
{"level": "EPSG:25830:13","scale": 90000,"resolution": 23.812547625095252},
{"level": "EPSG:25830:14","scale": 80000,"resolution": 21.166709000084669},
{"level": "EPSG:25830:15","scale": 70000,"resolution": 18.520870375074086},
{"level": "EPSG:25830:16","scale": 60000,"resolution": 15.875031750063501},
{"level": "EPSG:25830:17","scale": 50000,"resolution": 13.229193125052918},
{"level": "EPSG:25830:18","scale": 40000,"resolution": 10.583354500042335},
{"level": "EPSG:25830:19","scale": 30000,"resolution": 7.9375158750317505},
{"level": "EPSG:25830:20","scale": 25000,"resolution": 6.6145965625264589},
{"level": "EPSG:25830:21","scale": 20000,"resolution": 5.2916772500211673},
{"level": "EPSG:25830:22","scale": 15000,"resolution": 3.9687579375158752},
{"level": "EPSG:25830:23","scale": 12500,"resolution": 3.3072982812632294},
{"level": "EPSG:25830:24","scale": 10000,"resolution": 2.6458386250105836},
{"level": "EPSG:25830:25","scale": 7500,"resolution": 1.9843789687579376},
{"level": "EPSG:25830:26","scale": 5000,"resolution": 1.322919312505290},
{"level": "EPSG:25830:27","scale": 3000,"resolution": 0.793751587503175},
{"level": "EPSG:25830:28","scale": 2000,"resolution": 0.529167725002117},
{"level": "EPSG:25830:29","scale": 1000,"resolution": 0.264583862501058},
{"level": "EPSG:25830:30","scale": 500,"resolution": 0.132291931250529}]
});
var tileExtent1 = new esri.geometry.Extent(400000, 4100000, 1100000, 4600000, new esri.SpatialReference({wkid: 25830}));
var layerInfo_Orto = new esri.layers.WMTSLayerInfo({
tileInfo: tileInfo1,
fullExtent: tileExtent1,
initialExtent: tileExtent1,
identifier: "Ortofoto_ICV",
tileMatrixSet: "EPSG:25830",
format: "jpeg",
style: "_null"
});
var options_Orto = {
id: "Web_Ortofoto",
visible: true,
serviceMode: "KVP",
layerInfo: layerInfo_Orto
};
var CapaOrtofoto = new esri.layers.WMTSLayer("http://cartoweb.cma.gva.es/geowebcache/service/wmts", options_Orto);


What is wrong in definition of WMTS layer?

Another problem is when I zoom or Pan, the WMTS Layer hides.

The property "visible: true" in "options_Orto" is correct?

Thanks in advance.

Pau Pérez Puigcerver
Prodevelop SL
Conselleria de Infraestructuras, Territorio y Medio Ambiente
http://cartoweb.cma.gva.es
0 Kudos
0 Replies