[OpenLayers-Users] HOWTO: GWC, layer MaxExtent - setting it up correctly to avoid misaligned tiles

Phil Scadden p.scadden at gns.cri.nz
Thu Sep 27 17:01:50 PDT 2012


Having battled with this on and off for quite a while, I think I finally 
have a solution.

If you are using WMS with a caching system, (eg GeoWebCache), and put a 
restriction on a layer extent, then you can end up with mess.

Symptoms, - misalignment of layers with basemap, repetition of parts of 
a layer on a map.

The cause is Openlayers issuing BBOX requests that dont align with GWC 
tiles.

The fix. If you are going to specify a maxExtent on a layer, you MUST 
also supply a tileOrigin

eg code.
layer = new OpenLayers.Layer.WMS(name, serverUrl, { layers: layerName, 
tiled:true, transparent: true },
  { tileOrigin: new 
OpenLayers.LonLat(map.maxExtent.left,map.maxExtent.bottom), 
maxExtent:myMaxExtent, });
-- 
Phil Scadden, Senior Scientist GNS Science Ltd 764 Cumberland St, 
Private Bag 1930, Dunedin, New Zealand Ph +64 3 4799663, fax +64 3 477 5232

Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.



More information about the Users mailing list