Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
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/… –  geographika Dec 9 '10 at 16:28
    
@geographika: Why would then the same layer display correctly without GWC mode then? –  radek Dec 9 '10 at 16:33
1  
It uses a different config file for projections? See geoserver.org/display/GEOSDOC/5.+GWC+-+GeoWebCache –  geographika Dec 9 '10 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 '10 at 16:00
add comment

4 Answers 4

up vote 4 down vote accepted
+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.

share|improve this answer
    
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 '10 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. –  geographika Dec 13 '10 at 20:37
add comment

Have you tried clearing the cache?

share|improve this answer
    
Yes, I did. –  radek Dec 19 '10 at 14:44
add comment

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.

share|improve this answer
    
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 '10 at 12:35
    
What are your GWC settings, you may need to adjust DPI settings in either GWC or OpenLayers –  Peter Dec 15 '10 at 19:07
    
I tried adjusting DPI settings according to GWC demo preview of the layer. Didn't help. –  radek Dec 17 '10 at 20:31
add comment

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.

share|improve this answer
    
Yes, dataset is in 3857 and GWC is also configured for it. –  radek Dec 9 '10 at 16:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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