[GIS] GeoWebCache: misalignment of tiles

geoservergeowebcacheopenlayers-2web-mapping

I'm trying to test simple web map based on PostGIS/Geoserver/OpenLayers stack on Windows Server 2008.

When I load my WMS layer by:

var gwctest = new OpenLayers.Layer.WMS(
    "gwctest",
    "http://localhost:1979/geoserver/wms",
    {
    'layers': 'Index2000:index_vect_s100',
    'format': 'image/png',
    'srs': 'EPSG:3857', 
    'units': 'm',
    'transparent': true
    },
    {'opacity': 0.8, 'isBaseLayer': false, 'visibility': false}

);

Everything seems to be fine.

alt text

However, when I try to add WMS layer to my map using GeoWebCache, replacing

"http://localhost:1979/geoserver/wms"

with:

"http://localhost:1979/geoserver/gwc/service/wms"

My data suddenly move from correct position:

alt text

Any ideas on what may be the cause?

EDIT: some additional info on GWC mailing list post.

Best Answer

Update

See responses to Radek's post in the GWC forum for actual cause and solution. I now understand why TileCache opted for displaying errors such as "Current x value -1311047.936977 is too far from tile corner x -1493907.560000" rather than passing back the "closest" tiles within an arbitary error range.


Is your original data in EPSG 3857? If not then it is almost certainly a datum shift (not) happening somewhere.

Try changing your OpenLayers definition to reference EPSG:900913 - maybe GeoWebCache doesn't recognise the new web mercator code?

From the link you posted:

The integrated version of GeoWebCache automatically configures every layer with the two most common projections:

* EPSG:4326 (standard Latitude/Longitude)
* EPSG:900913 (Spherical Mercator, the projection used in Google Maps)

If you need additional projections you can create a configuration file called geowebcache.xml in the cache directory, for example /var/geoserver_data/gwc/geowebcache.xml

That sounds as though Geoserver and GeoWebCache use different projection files. Maybe your Geoserver has a to_wgs parameter and GWC doesn't.

As you are on Windows run Process Monitor - http://technet.microsoft.com/en-us/sysinternals/bb896645 to see which files you are really accessing.

Also I presume the images weren't cached after you changed some projection parameters? Try reseeding / deleting to check.

Related Question