10

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.

8
  • 1
    It looks like a datum shift issue. You may need to edit your projection to_wgs parameters if your wms is being reprojected. trac.osgeo.org/proj/wiki/… Dec 9, 2010 at 16:28
  • @geographika: Why would then the same layer display correctly without GWC mode then?
    – radek
    Dec 9, 2010 at 16:33
  • 1
    It uses a different config file for projections? See geoserver.org/display/GEOSDOC/5.+GWC+-+GeoWebCache Dec 9, 2010 at 18:22
  • @geographika: I presume it's an old version of GeoServer docs. Newer version: geoserver.org/display/GEOSDOC/5.+GWC+-+GeoWebCache. My GeoWebCache Configuration page says the tiles are ready in 3857 projection, and this is proj used by my web map as well.
    – radek
    Dec 10, 2010 at 16:00
  • did you ever solve your issue? I am having a similar issue with a greater shift. I see that geographika talsk about a post with causes end solution in the GWC forum, but I don´t find that post.
    – user28386
    Nov 12, 2015 at 14:11

4 Answers 4

4
+50

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.

2
  • Thanks. Yes, the original data is in 3857. Seems like GWC recognizes this code: in GWC Demos section there are all three projections available to use: 3857, 4326, 900913. And for the purpose of my map I'm using 3857. Also tried it with 900913 and error remains.
    – radek
    Dec 13, 2010 at 17:07
  • If your original data is in 3857 without a datum shift then I'd imagine no reprojection takes place in GWC, and your original data needs to be reprojected again. Dec 13, 2010 at 20:37
4

Do you have the correct tile-origin set for your OpenLayers.Map as in GeoWebCache. Check how the TileOrigin is set in the GeoWebCache-demo of the layer and make sure you have the same TileOrigin on your OpenLayers.Map Constructor.

3
  • Thanks. I've tried setting it as: "tilesOrigin : map.maxExtent.left + ',' + map.maxExtent.bottom" where maxExtent is set according to GWC demo of the layer. Still not correct.
    – radek
    Dec 15, 2010 at 12:35
  • What are your GWC settings, you may need to adjust DPI settings in either GWC or OpenLayers
    – Peter
    Dec 15, 2010 at 19:07
  • I tried adjusting DPI settings according to GWC demo preview of the layer. Didn't help.
    – radek
    Dec 17, 2010 at 20:31
3

Misalignment such as this is almost always a projection issue. Is the data stored in EPSG:3857? Check that the GeoWebCache layer is configured to output in EPSG:3857.

1
  • Yes, dataset is in 3857 and GWC is also configured for it.
    – radek
    Dec 9, 2010 at 16:07
2

Have you tried clearing the cache?

1
  • Yes, I did.
    – radek
    Dec 19, 2010 at 14:44

Your Answer

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

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