Having successfully used the new OpenLayers.Layer.GeoWebCache to add a local tile cache created using Geowebcache, I thought I would compare against the same data as a wms from my local GeoServer.

Looking at the geowebcache.js file there is an option to specify the cache layer as a base layer, so I sent it to false and added a layer switcher to the map

Both layers add to the map however there is a significant offset. enter image description here

The cache layer is the one that is set to the right.

In the geowebcache.js there is no mention of offset needing to be set.

Any ideas on what would cause this and what I need to change?



As requested my openlayers code

<script src="http://openlayers.org/api/OpenLayers.js"></script>
<script src="geowebcache.js" type="text/javascript"></script>
<script type="text/javascript">
     var map;
        function init() {

            var world = new OpenLayers.Bounds(
                0, 0, 700000, 1344000

            map = new OpenLayers.Map({
                div: "map",
                projection: new OpenLayers.Projection("EPSG:27700"),
                numZoomLevels: 11,
                resolutions: [896,448,224,112,56,28,14,7,4,2,1],
                maxExtent: world,
                center: new OpenLayers.LonLat(400000, 500000),
                zoom: 11

            map.addControl(new OpenLayers.Control.LayerSwitcher());

            var cache = new OpenLayers.Layer.GeoWebCache({
                  url: "https://url/",
                  isBaseLayer: false,
                  name: "Cache Layer",
                  gridSetId: "zoommap",

            // Add WMS layer to our map

            var bwms = new OpenLayers.Layer.WMS( "Base Map",
              { "transparent":"false",
                isBaseLayer: true,
                "format":"image/png" },
              { "reproject":"true" }

            // Add WMS layer to our map

Here is my GWC configuration file


<?xml version="1.0" encoding="utf-8"?>
    <gwcConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://geowebcache.org/schema/1.5.0 http://geowebcache.org/schema/1.5.0/geowebcache.xsd" xmlns="http://geowebcache.org/schema/1.5.0">

The data is stored in a PostGIS database and the projection is definitely EPSG:27700.

As you can see I have defined the projection in my OpenLayers code and included the same resolutions as my geowebcache configuration resolutions.

  • Please provide your OpenLayers code and/or your GeoWebCache config. Also, what is your data projection? Nov 7, 2013 at 19:16
  • updated with all my HTML code and geowebcache config file
    – tjmgis
    Nov 7, 2013 at 19:23

1 Answer 1


First tentative answer:

In your GeoWebCache config...

  • try with tileHeight and tileWidth of 256 instead of 250
  • try changing the name of your grid to EPSG:27700

Next, and most important, try using the full extent of the projection and not just the region covered by your data. If I'm not mistaken, EPSG:27700 extent is:

1393.0196, 13494.9764, 671196.3657, 1230275.0454

See: http://spatialreference.org/ref/epsg/27700/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.