Hil,

I 've a configuration question/problem concerning tiled layers.
In geoserver I defined a WMS layer and also configured caching for this layer.
To configure this layer in drupal, there are 2 options:

  1. define a WMTS layer: I tried, but did not succeed. With the UI I cannot properly configure the parameters TILEMATRIX,TILEROW and TILECOL. It generates requests with tilerows and tilecolums that are out of range.
  2. define a WMS layer and point to the geowebcache endpoint of geoserver. this works perfect if I would be able to explicitly define the zoom levels (resolution) of my openlayers map so that they correspond to the defined resolutions in the cache.

Is there an approach to avoid WMTS requests with tilerows and tilecolums that are out of range (option1)?
OR
Is there a way to configure the number of zoom levels and the different resolutions of the map in the drupal openlayers module(option2)?

Below my html test code (outside drupal). For me this code works perfect and I have direct access to my cached layer. For external persons it will not work as it points to an internal server, but it gives you an idea what I mean.

cheers,
Diederik

<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="imagetoolbar" content="no">
<title>tiled layer test EPSG:31370 image/png</title>
<style type="text/css">
body { font-family: sans-serif; font-weight: bold; font-size: .8em; }
body { border: 0px; margin: 0px; padding: 0px; }
#map { width: 85%; height: 85%; border: 0px; padding: 0px; }
</style>
<script src="openlayers/OpenLayers.js"></script>    
<script type="text/javascript">               
var map, demolayer;                               
  // sets the chosen modifiable parameter        
  function setParam(name, value){                
   str = "demolayer.mergeNewParams({" + name + ": '" + value + "'})" 
   // alert(str);                                   
   eval(str);                                    
  }                                              
OpenLayers.DOTS_PER_INCH = 90.71428571428572;
OpenLayers.Util.onImageLoadErrorColor = 'transparent';
function init(){
var mapOptions = { 
<strong>resolutions: [1024,512,256,128,64],</strong>
projection: new OpenLayers.Projection('EPSG:31370'),
maxExtent: new OpenLayers.Bounds(16478.795,19244.928,301307.738,304073.87100000004),
units: "meters",
controls: []
};
map = new OpenLayers.Map('map', mapOptions );
map.addControl(new OpenLayers.Control.PanZoomBar({
		position: new OpenLayers.Pixel(2, 15)
}));
map.addControl(new OpenLayers.Control.Navigation());
map.addControl(new OpenLayers.Control.Scale($('scale')));
map.addControl(new OpenLayers.Control.MousePosition({element: $('location')}));
demolayer = new OpenLayers.Layer.WMS(
"potentiekaart","http://10.33.211.178:8080<strong>/geoserver/gwc/service/wms</strong>",
{layers: 'rm:potentiekaart', format: 'image/png' },
{ tileSize: new OpenLayers.Size(256,256)});
map.addLayer(demolayer);
map.zoomToExtent(new OpenLayers.Bounds(10598.646900179854,17117.071300489828,307960.58239541977,248191.24333491083));

}
;
</script>
</head>
<body onload="init()">
<div id="params"></div>
<div id="map"></div>
<div id="nodelist"></div>
</body>
</html>
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Pol’s picture

Issue summary: View changes

Updated issue summary.

dtirry’s picture

Title: configuration cached layers (geoserver) » TMS flips tiles
Category: support » bug

Hi,

I'm trying to configure TMS and WMTS layers to be added in an OL map. Configuration went finally successful, however OL seems to flip tiles and is requesting tiles that are out of range. For example when previewing the map following tiles are shown:

../{layer_name/1/0/0.png
../{layer_name/1/-1/0.png

obviously there is no -1 in the tiling scheme.

I've created tiles on my own data using geoserver&gwc. Could it be that it has not been taken into account that for example google maps, bing maps etc... apply different tiling schemes than the ones created with geoserver?

dpw’s picture

Rather than start a new issue, I'll add to this one since the OP first mentioned issues I've seen using the WMTS layer type.

Like the OP, I can retrieve maps via WMTS outside of Drupal (using OpenLayers to Geoserver) but if I create a WMTS layer type, the maps are not displayed (the same maps work with WMS layer type in OpenLayers Drupal, but I can't get the tiled version to work). In my example, I've used GeoWebCache to store the tiles.

When I debug the call in Firebug, I get the following call which generates an error:

http://xxx.com/geoserver/gwc/service/wmts/?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=workspace%3Alayer_name&STYLE=&TILEMATRIXSET=EPSG%3A900913&TILEMATRIX=6&TILEROW=0&TILECOL=0&FORMAT=image%2Fpng

If I change some parameters in the GetTile request, I can get it working... (Change TILEMATRIX=EPSG:900913:6 instead of TILEMATRIX=6, TILEROW=23 instead of TILEROW=0, TILECOL=9 instead of TILECOL=0).

Can anyone offer other suggestions or point me to working WMTS examples? Where in the OpenLayers module does this request get built?

friedjoff’s picture

Hi dpw,

the WMTS layer gets built here: plugins/layer_types/openlayers_layer_type_wmts.js

Can you apply the attached patch to the OpenLayers module and see if it works with your WMTS layer?

dpw’s picture

Hi friedjoff,

Thanks for the patch. It fixed the TILEMATRIX=ESPG:900913:X parameter, but the request still doesn't find a correct TILEROW and TILECOL. It returns an error that "Column 0 is out of range, min:9 max:11" (for example) and these values change based on the zoom level.

I'm looking at GeoWebCache on the server to see if the tile numbering is set anywhere.

Any ideas?

friedjoff’s picture

Hm, which map projection do you use? Works for me with EPSG:900913 (ie. MapQuest OSM).

Pol’s picture

@friedjoff, thanks for the patch, committed right away !

dpw’s picture

Yes, I've tried with EPSG:900913 on MapQuest OSM and it is still sending TILEROW=0 and TILECOL=0 for all requests...

e.g. "Row 0 is out of range: min: 23 max:25" and if I fix the Row and Col, a proper image is returned.

Seems the TILEROW and TILECOL values are not updating. The WMTS "geoserver.dispatch.application" document seems to include the correct values for TILEROW and TILECOL based on the zoomlevel, so I assume this information gets sent back via openlayers. Anyway, not sure what other info I can provide, or what other tests I can run.

dpw’s picture

Issue summary: View changes

Updated issue summary.

Pol’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.