Discussion:
Problem with GeoWebCache and EPSG:32630 layers
(too old to reply)
Richard Cross
2010-06-24 13:02:52 UTC
Permalink
Hi,

I'm new to Geoserver and am trying to get better performance by using the built-in GeoWebCache. However, I found the instructions for this rather confusing. I have added a new location for the GeoWebCache directory in web.xml, and changed the mapserver URL to include gwc/service for my requests via OpenLayers.

The documentation also advises that for projections other than EPSG:4326 and EPSG:900913, I will need to create a geowebcache.xml; but this is where it all goes a bit wrong. I am directed to a documentation page at http://geowebcache.org/trac/wiki/configuration; however, for configuring the built-in version of GeoWebCache, I am directed back to the GeoServer website!

I've tried creating a document like the one at http://geowebcache.org/docs/current/configuration/xml/exhaustive.html and have included it below. However, I keep getting pink tiles instead of my map and the following error in my server log:

2010-06-24 13:56:09,736 INFO [STDOUT] (ajp-0.0.0.0-8009-5) 24 Jun 13:56:09 ERROR [geowebcache.GeoWebCacheDispatcher] - Requested horizontal resolution: 4.5857031250002365 , best match: 3.480507812499809 exceeds 10% threshold. Perhaps the client is configured with an incorrect set of scales (resolutions), or the DPI setting is off compared to the one in GWC ? http://localhost:8080/geoserver/gwc/service/wms

Right now, I don't know if the problem is with my Javascript/OpenLayers page (also included below), GeoServer or GeoWebCache configuration. Can anyone help?

Regards,

Richard Cross

-- geowebcache.xml --

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

<version>1.1.5</version>
<backendTimeout>120</backendTimeout>
<cacheBypassAllowed>false</cacheBypassAllowed>

<gridSets>
<gridSet>
<name>EPSG 32630</name>
<srs>
<number>32630</number>
</srs>
<extent>
<coords>
<double>-6.0</double>
<double>-0.0</double>
<double>0.0</double>
<double>84.0</double>
</coords>
</extent>
<metersPerUnit>1</metersPerUnit>
<pixelSize>0.00028</pixelSize>
</gridSet>
</gridSets>
<layers>
<wmsLayer>
<name>airport-cached</name>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG 32630</gridSetName>
<extent>
<coords>
<double>-0.217</double>
<double>51.14</double>
<double>-0.149</double>
<double>51.169</double>
</coords>
</extent>
</gridSubset>
</gridSubsets>
<wmsUrl>
<string>https://localhost:8080/geoserver/wms</string>
</wmsUrl>
<wmsLayers>demo_group</wmsLayers>
</wmsLayer>
</layers>
</gwcConfiguration>

-- Web Page --

<html>
<head>
<title>Demo</title>
<script src="http://localhost:8080scripts/BrowserDetect.js"></script>
<script src="http://localhost:8080/scripts/OpenLayers.js"></script>
</head>
<body>
<div style="width:100%; height:100%" id="map"></div>
<script defer="defer" type="text/javascript">
var mapServerUrl = "http://localhost:8080/geoserver/gwc/service/wms"; // Link for GeoWebCache
//var mapServerUrl = "http://localhost:8080/geoserver/wms"; // Link for GeoServer - works!
var format = undefined;

if (BrowserDetect.browser != "Explorer") {
format = "image/png";
}

// pink tile avoidance
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 5;
// make OL compute scale according to WMS spec
OpenLayers.DOTS_PER_INCH = 25.4 / 0.28;

var bounds = new OpenLayers.Bounds(
694654.802, 5669301.505,
699350.562, 5672257.806
);

var options = {
maxExtent: bounds,
maxResolution: 18.342812500000036,
projection: "EPSG:32630"
};

var map = new OpenLayers.Map('map', options);

var airport = new OpenLayers.Layer.WMS( "Airport", mapServerUrl, {
srs: "EPSG:32630",
format: format,
layers: 'airport-cached'
});

var lgw_stands = new OpenLayers.Layer.WMS( "Stands", mapServerUrl, {
srs: "EPSG:32630",
format: format,
transparent: true,
layers: 'lgw:EGKKStands'
},
{
isBaseLayer: false,
visibility: true
});

map.addLayers( [ airport, lgw_stands ]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.zoomToExtent(bounds);
</script>
</body>
</html>
Arne Kepp
2010-06-24 14:50:44 UTC
Permalink
Ok, you're on the right track, but you've got a few steps to go.

Everything has to be specified in EPSG:32630 coordinates. Looking at
http://spatialreference.org/ref/epsg/32630/ , I would use the following.
The gridSubset coordinates are just eyeballed, you can tighten them up
if you have an accurate bounding box for your data.

Then restart GeoServer and check the log to see that this
geowebcache.xml is actually loaded. I would not define the cache
directory, instead just stick the file into <geoserver data
dir>/gwc/geowebcache.xml

Finally, check http://localhost:8080/geoserver/gwc/demo and look at how
that OpenLayers client for EPSG:32630 is defined, you'll want to get the
resolutions array and max extent from it and use it in your own client.

-Arne

...

<gridSets>
<gridSet>
<name>EPSG:32630</name>
<srs>
<number>32630</number>
</srs>
<extent>
<coords>
<double>166021.4431</double>
<double>0.0</double>
<double>833978.5569</double>
<double>9329005.1825</double>
</coords>
</extent>
</gridSet>
</gridSets>
<layers>
<wmsLayer>
<name>airport-cached</name>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG:32630</gridSetName>
<extent>
<coords>
<double>739505.82</double>
<double>5666250.55</double>
<double>745834.18</double>
<double>5669751.88</double>
</coords>
</extent>
</gridSubset>
</gridSubsets>
...
Post by Richard Cross
Hi,
I'm new to Geoserver and am trying to get better performance by using the built-in GeoWebCache. However, I found the instructions for this rather confusing. I have added a new location for the GeoWebCache directory in web.xml, and changed the mapserver URL to include gwc/service for my requests via OpenLayers.
The documentation also advises that for projections other than EPSG:4326 and EPSG:900913, I will need to create a geowebcache.xml; but this is where it all goes a bit wrong. I am directed to a documentation page at http://geowebcache.org/trac/wiki/configuration; however, for configuring the built-in version of GeoWebCache, I am directed back to the GeoServer website!
2010-06-24 13:56:09,736 INFO [STDOUT] (ajp-0.0.0.0-8009-5) 24 Jun 13:56:09 ERROR [geowebcache.GeoWebCacheDispatcher] - Requested horizontal resolution: 4.5857031250002365 , best match: 3.480507812499809 exceeds 10% threshold. Perhaps the client is configured with an incorrect set of scales (resolutions), or the DPI setting is off compared to the one in GWC ? http://localhost:8080/geoserver/gwc/service/wms
Right now, I don't know if the problem is with my Javascript/OpenLayers page (also included below), GeoServer or GeoWebCache configuration. Can anyone help?
Regards,
Richard Cross
-- geowebcache.xml --
<?xml version="1.0" encoding="utf-8"?>
<gwcConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://geowebcache.org/schema/1.2.2/geowebcache.xsd"
xmlns="http://geowebcache.org/schema/1.2.2"
xsi:schemaLocation="http://geowebcache.org/schema/1.2.2 http://geowebcache.org/schema/1.2.2/geowebcache.xsd">
<version>1.1.5</version>
<backendTimeout>120</backendTimeout>
<cacheBypassAllowed>false</cacheBypassAllowed>
<gridSets>
<gridSet>
<name>EPSG 32630</name>
<srs>
<number>32630</number>
</srs>
<extent>
<coords>
<double>-6.0</double>
<double>-0.0</double>
<double>0.0</double>
<double>84.0</double>
</coords>
</extent>
<metersPerUnit>1</metersPerUnit>
<pixelSize>0.00028</pixelSize>
</gridSet>
</gridSets>
<layers>
<wmsLayer>
<name>airport-cached</name>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG 32630</gridSetName>
<extent>
<coords>
<double>-0.217</double>
<double>51.14</double>
<double>-0.149</double>
<double>51.169</double>
</coords>
</extent>
</gridSubset>
</gridSubsets>
<wmsUrl>
<string>https://localhost:8080/geoserver/wms</string>
</wmsUrl>
<wmsLayers>demo_group</wmsLayers>
</wmsLayer>
</layers>
</gwcConfiguration>
-- Web Page --
<html>
<head>
<title>Demo</title>
<script src="http://localhost:8080scripts/BrowserDetect.js"></script>
<script src="http://localhost:8080/scripts/OpenLayers.js"></script>
</head>
<body>
<div style="width:100%; height:100%" id="map"></div>
<script defer="defer" type="text/javascript">
var mapServerUrl = "http://localhost:8080/geoserver/gwc/service/wms"; // Link for GeoWebCache
//var mapServerUrl = "http://localhost:8080/geoserver/wms"; // Link for GeoServer - works!
var format = undefined;
if (BrowserDetect.browser != "Explorer") {
format = "image/png";
}
// pink tile avoidance
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 5;
// make OL compute scale according to WMS spec
OpenLayers.DOTS_PER_INCH = 25.4 / 0.28;
var bounds = new OpenLayers.Bounds(
694654.802, 5669301.505,
699350.562, 5672257.806
);
var options = {
maxExtent: bounds,
maxResolution: 18.342812500000036,
projection: "EPSG:32630"
};
var map = new OpenLayers.Map('map', options);
var airport = new OpenLayers.Layer.WMS( "Airport", mapServerUrl, {
srs: "EPSG:32630",
format: format,
layers: 'airport-cached'
});
var lgw_stands = new OpenLayers.Layer.WMS( "Stands", mapServerUrl, {
srs: "EPSG:32630",
format: format,
transparent: true,
layers: 'lgw:EGKKStands'
},
{
isBaseLayer: false,
visibility: true
});
map.addLayers( [ airport, lgw_stands ]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.zoomToExtent(bounds);
</script>
</body>
</html>
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Geoserver-users mailing list
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Richard Cross
2010-06-24 19:40:32 UTC
Permalink
Hi, that was extremely helpful - particularly the GWC Demo, which I hadn't stumbled across in GeoServer yet!

When I looked in there, I noticed that there were entries not only for the "airport-cached" layer I configured in geowebcache.xml, but also for every single layer (and layer group) configured in GeoServer, complete with EPSG:32630. So I'm now wondering whether I really need to create a layer in geowebcache.xml or just create the GridSet?

Also, regarding using the resolutions array from the GWC Demo code for my OpenLayers client: each layer has a different set of resolutions, and combining them together doesn't seem to work. How can I get the right resolution set for my map object when I then want to add two different layers (both served from GWC)?

Regards,

Richard Cross.
Post by Arne Kepp
Ok, you're on the right track, but you've got a few steps to go.
Everything has to be specified in EPSG:32630 coordinates. Looking at http://spatialreference.org/ref/epsg/32630/ , I would use the following. The gridSubset coordinates are just eyeballed, you can tighten them up if you have an accurate bounding box for your data.
Then restart GeoServer and check the log to see that this geowebcache.xml is actually loaded. I would not define the cache directory, instead just stick the file into <geoserver data dir>/gwc/geowebcache.xml
Finally, check http://localhost:8080/geoserver/gwc/demo and look at how that OpenLayers client for EPSG:32630 is defined, you'll want to get the resolutions array and max extent from it and use it in your own client.
-Arne
...
<gridSets>
<gridSet>
<name>EPSG:32630</name>
<srs>
<number>32630</number>
</srs>
<extent>
<coords>
<double>166021.4431</double>
<double>0.0</double>
<double>833978.5569</double>
<double>9329005.1825</double>
</coords>
</extent>
</gridSet>
</gridSets>
<layers>
<wmsLayer>
<name>airport-cached</name>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG:32630</gridSetName>
<extent>
<coords>
<double>739505.82</double>
<double>5666250.55</double>
<double>745834.18</double>
<double>5669751.88</double>
</coords>
</extent>
</gridSubset>
</gridSubsets>
...
Post by Richard Cross
Hi,
I'm new to Geoserver and am trying to get better performance by using the built-in GeoWebCache. However, I found the instructions for this rather confusing. I have added a new location for the GeoWebCache directory in web.xml, and changed the mapserver URL to include gwc/service for my requests via OpenLayers.
The documentation also advises that for projections other than EPSG:4326 and EPSG:900913, I will need to create a geowebcache.xml; but this is where it all goes a bit wrong. I am directed to a documentation page at http://geowebcache.org/trac/wiki/configuration; however, for configuring the built-in version of GeoWebCache, I am directed back to the GeoServer website!
2010-06-24 13:56:09,736 INFO [STDOUT] (ajp-0.0.0.0-8009-5) 24 Jun 13:56:09 ERROR [geowebcache.GeoWebCacheDispatcher] - Requested horizontal resolution: 4.5857031250002365 , best match: 3.480507812499809 exceeds 10% threshold. Perhaps the client is configured with an incorrect set of scales (resolutions), or the DPI setting is off compared to the one in GWC ? http://localhost:8080/geoserver/gwc/service/wms
Right now, I don't know if the problem is with my Javascript/OpenLayers page (also included below), GeoServer or GeoWebCache configuration. Can anyone help?
Regards,
Richard Cross
-- geowebcache.xml --
<?xml version="1.0" encoding="utf-8"?>
<gwcConfiguration xmlns:xsi=MailScanner has detected a possible fraud attempt from "www.w3.org" claiming to be "http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=MailScanner has detected a possible fraud attempt from "geowebcache.org" claiming to be "http://geowebcache.org/schema/1.2.2/geowebcache.xsd"
xmlns=MailScanner has detected a possible fraud attempt from "geowebcache.org" claiming to be "http://geowebcache.org/schema/1.2.2"
xsi:schemaLocation=MailScanner has detected a possible fraud attempt from "geowebcache.org" claiming to be "http://geowebcache.org/schema/1.2.2 http://geowebcache.org/schema/1.2.2/geowebcache.xsd">
<version>1.1.5</version>
<backendTimeout>120</backendTimeout>
<cacheBypassAllowed>false</cacheBypassAllowed>
<gridSets>
<gridSet>
<name>EPSG 32630</name>
<srs>
<number>32630</number>
</srs>
<extent>
<coords>
<double>-6.0</double>
<double>-0.0</double>
<double>0.0</double>
<double>84.0</double>
</coords>
</extent>
<metersPerUnit>1</metersPerUnit>
<pixelSize>0.00028</pixelSize>
</gridSet>
</gridSets>
<layers>
<wmsLayer>
<name>airport-cached</name>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG 32630</gridSetName>
<extent>
<coords>
<double>-0.217</double>
<double>51.14</double>
<double>-0.149</double>
<double>51.169</double>
</coords>
</extent>
</gridSubset>
</gridSubsets>
<wmsUrl>
<string>https://localhost:8080/geoserver/wms</string>
</wmsUrl>
<wmsLayers>demo_group</wmsLayers>
</wmsLayer>
</layers>
</gwcConfiguration>
-- Web Page --
<html>
<head>
<title>Demo</title>
<script src="http://localhost:8080scripts/BrowserDetect.js"></script>
<script src="http://localhost:8080/scripts/OpenLayers.js"></script>
</head>
<body>
<div style="width:100%; height:100%" id="map"></div>
<script defer="defer" type="text/javascript">
var mapServerUrl = "http://localhost:8080/geoserver/gwc/service/wms"; // Link for GeoWebCache
//var mapServerUrl = "http://localhost:8080/geoserver/wms"; // Link for GeoServer - works!
var format = undefined;
if (BrowserDetect.browser != "Explorer") {
format = "image/png";
}
// pink tile avoidance
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 5;
// make OL compute scale according to WMS spec
OpenLayers.DOTS_PER_INCH = 25.4 / 0.28;
var bounds = new OpenLayers.Bounds(
694654.802, 5669301.505,
699350.562, 5672257.806
);
var options = {
maxExtent: bounds,
maxResolution: 18.342812500000036,
projection: "EPSG:32630"
};
var map = new OpenLayers.Map('map', options);
var airport = new OpenLayers.Layer.WMS( "Airport", mapServerUrl, {
srs: "EPSG:32630",
format: format,
layers: 'airport-cached'
});
var lgw_stands = new OpenLayers.Layer.WMS( "Stands", mapServerUrl, {
srs: "EPSG:32630",
format: format,
transparent: true,
layers: 'lgw:EGKKStands'
},
{
isBaseLayer: false,
visibility: true
});
map.addLayers( [ airport, lgw_stands ]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.zoomToExtent(bounds);
</script>
</body>
</html>
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Geoserver-users mailing list
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Arne Kepp
2010-06-24 20:11:25 UTC
Permalink
Hi,

so the resolutions are calculated (if not set explicitly) when the grid
set is defined. Create more wmsLayer instances in the file as shown
below, setting xmin,ymin,xmax,ymax for each. Alternatively you can just
pick a bounding box that covers all of your layers.

I was hoping to get the CRS extent in GeoServer, so that you don't end
up with X different grid sets for the same projection, just haven't
gotten there yet. So what you're seeing is that it creates a separate
grid set for every layer bounding box.

-Arne

<wmsLayer>
<name>airport-cached</name>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG:32630</gridSetName>
<extent>
<coords>
<double>739505.82</double>
<double>5666250.55</double>
<double>745834.18</double>
<double>5669751.88</double>
</coords>
</extent>
</gridSubset>
</gridSubsets>
....


<wmsLayer>
<name>somethingelse-cached</name>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG:32630</gridSetName>
<extent>
<coords>
<double>xmin</double>
<double>ymin</double>
<double>xmax</double>
<double>ymax</double>
</coords>
</extent>
</gridSubset>
</gridSubsets>
....
Post by Richard Cross
Hi, that was extremely helpful - particularly the GWC Demo, which I
hadn't stumbled across in GeoServer yet!
When I looked in there, I noticed that there were entries not only for
the "airport-cached" layer I configured in geowebcache.xml, but also
for every single layer (and layer group) configured in GeoServer,
complete with EPSG:32630. So I'm now wondering whether I really need
to create a layer in geowebcache.xml or just create the GridSet?
Also, regarding using the resolutions array from the GWC Demo code for
my OpenLayers client: each layer has a different set of resolutions,
and combining them together doesn't seem to work. How can I get the
right resolution set for my map object when I then want to add two
different layers (both served from GWC)?
Regards,
Richard Cross.
Richard Cross
2010-06-25 09:01:49 UTC
Permalink
Hmm, when I try and view the cached layers I created in geowebcache.xml (below) via the GWC demo, I get a blank screen with no tiles. Have I missed something vital from geowebcache.xml? The OpenLayers client code from GWC follows - the resolutions and maxExtent look a little strange to me.

-- OpenLayers code from GWC Demo page for "stands-cached" from geowebcache below --

<script type="text/javascript">
OpenLayers.DOTS_PER_INCH = 90.71428571428572;
OpenLayers.Util.onImageLoadErrorColor = 'transparent';
var map, layer;
function init(){
var mapOptions = {
resolutions: [Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity],
projection: new OpenLayers.Projection('EPSG:32630'),
maxExtent: new OpenLayers.Bounds(NaN,NaN,NaN,NaN),
units: "meters",
controls: []
};
map = new OpenLayers.Map('map', mapOptions );
map.addControl(new OpenLayers.Control.PanZoomBar({
position: new OpenLayers.Pixel(2, 15)
}));
map.addControl(new OpenLayers.Control.Navigation());
map.addControl(new OpenLayers.Control.Scale($('scale')));
map.addControl(new OpenLayers.Control.MousePosition({element: $('location')}));
var demolayer = new OpenLayers.Layer.WMS(
"stands-cached","../service/wms",
{layers: 'stands-cached', format: 'image/png' },
{ tileSize: new OpenLayers.Size(256,256) }
);
map.addLayer(demolayer);
map.zoomToExtent(new OpenLayers.Bounds(696573.3,5670483.82,698355.32,5672265.84));
}
</script>


-- geowebcache.xml --

<?xml version="1.0" encoding="utf-8"?>
<gwcConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://geowebcache.org/schema/1.2.2/geowebcache.xsd"
xmlns="http://geowebcache.org/schema/1.2.2"
xsi:schemaLocation="http://geowebcache.org/schema/1.2.2 http://geowebcache.org/schema/1.2.2/geowebcache.xsd">
<version>1.2.2</version>
<backendTimeout>120</backendTimeout>
<cacheBypassAllowed>false</cacheBypassAllowed>
<gridSets>
<gridSet>
<name>EPSG:32630</name>
<srs>
<number>32630</number>
</srs>
<extent>
<coords>
<double>166021.4431</double>
<double>0.0</double>
<double>833978.5569</double>
<double>9329005.1825</double>
</coords>
</extent>
</gridSet>
</gridSets>
<layers>
<wmsLayer>
<name>airport-cached</name>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG:32630</gridSetName>
<extent>
<coords>
<double>694654.802</double>
<double>5669301.505</double>
<double>700567.404</double>
<double>5672257.806</double>
</coords>
</extent>
</gridSubset>
</gridSubsets>
<wmsUrl>
<string>http://locahost:8080/geoserver/wms</string>
</wmsUrl>
<wmsLayers>airport_group</wmsLayers>
</wmsLayer>
<wmsLayer>
<name>stands-cached</name>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG:32630</gridSetName>
<extent>
<coords>
<double>696573.3</double>
<double>5670483.82</double>
<double>698355.32</double>
<double>5672265.84</double>
</coords>
</extent>
</gridSubset>
</gridSubsets>
<wmsUrl>
<string>http://locahost:8080/geoserver/wms</string>
</wmsUrl>
<wmsLayers>LGW:EGKKStands</wmsLayers>
</wmsLayer>
</layers>
</gwcConfiguration>
Hi,
so the resolutions are calculated (if not set explicitly) when the grid set is defined. Create more wmsLayer instances in the file as shown below, setting xmin,ymin,xmax,ymax for each. Alternatively you can just pick a bounding box that covers all of your layers.
I was hoping to get the CRS extent in GeoServer, so that you don't end up with X different grid sets for the same projection, just haven't gotten there yet. So what you're seeing is that it creates a separate grid set for every layer bounding box.
-Arne
<wmsLayer>
<name>airport-cached</name>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG:32630</gridSetName>
<extent>
<coords>
<double>739505.82</double>
<double>5666250.55</double>
<double>745834.18</double>
<double>5669751.88</double>
</coords>
</extent>
</gridSubset>
</gridSubsets>
....
<wmsLayer>
<name>somethingelse-cached</name>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG:32630</gridSetName>
<extent>
<coords>
<double>xmin</double>
<double>ymin</double>
<double>xmax</double>
<double>ymax</double>
</coords>
</extent>
</gridSubset>
</gridSubsets>
....
Post by Richard Cross
Hi, that was extremely helpful - particularly the GWC Demo, which I hadn't stumbled across in GeoServer yet!
When I looked in there, I noticed that there were entries not only for the "airport-cached" layer I configured in geowebcache.xml, but also for every single layer (and layer group) configured in GeoServer, complete with EPSG:32630. So I'm now wondering whether I really need to create a layer in geowebcache.xml or just create the GridSet?
Also, regarding using the resolutions array from the GWC Demo code for my OpenLayers client: each layer has a different set of resolutions, and combining them together doesn't seem to work. How can I get the right resolution set for my map object when I then want to add two different layers (both served from GWC)?
Regards,
Richard Cross.
Arne Kepp
2010-06-25 10:09:56 UTC
Permalink
All those Infinity and NaN suggest a bug or an error in the grid that I
can't spot right now. You can try changing 0.0 to 0.0000001, but I'll
have to look into over the weekend.

-Arne
Post by Richard Cross
Hmm, when I try and view the cached layers I created in geowebcache.xml (below) via the GWC demo, I get a blank screen with no tiles. Have I missed something vital from geowebcache.xml? The OpenLayers client code from GWC follows - the resolutions and maxExtent look a little strange to me.
-- OpenLayers code from GWC Demo page for "stands-cached" from geowebcache below --
<script type="text/javascript">
OpenLayers.DOTS_PER_INCH = 90.71428571428572;
OpenLayers.Util.onImageLoadErrorColor = 'transparent';
var map, layer;
function init(){
var mapOptions = {
resolutions: [Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity],
projection: new OpenLayers.Projection('EPSG:32630'),
maxExtent: new OpenLayers.Bounds(NaN,NaN,NaN,NaN),
units: "meters",
controls: []
};
map = new OpenLayers.Map('map', mapOptions );
map.addControl(new OpenLayers.Control.PanZoomBar({
position: new OpenLayers.Pixel(2, 15)
}));
map.addControl(new OpenLayers.Control.Navigation());
map.addControl(new OpenLayers.Control.Scale($('scale')));
map.addControl(new OpenLayers.Control.MousePosition({element: $('location')}));
var demolayer = new OpenLayers.Layer.WMS(
"stands-cached","../service/wms",
{layers: 'stands-cached', format: 'image/png' },
{ tileSize: new OpenLayers.Size(256,256) }
);
map.addLayer(demolayer);
map.zoomToExtent(new OpenLayers.Bounds(696573.3,5670483.82,698355.32,5672265.84));
}
</script>
-- geowebcache.xml --
<?xml version="1.0" encoding="utf-8"?>
<gwcConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://geowebcache.org/schema/1.2.2/geowebcache.xsd"
xmlns="http://geowebcache.org/schema/1.2.2"
xsi:schemaLocation="http://geowebcache.org/schema/1.2.2 http://geowebcache.org/schema/1.2.2/geowebcache.xsd">
<version>1.2.2</version>
<backendTimeout>120</backendTimeout>
<cacheBypassAllowed>false</cacheBypassAllowed>
<gridSets>
<gridSet>
<name>EPSG:32630</name>
<srs>
<number>32630</number>
</srs>
<extent>
<coords>
<double>166021.4431</double>
<double>0.0</double>
<double>833978.5569</double>
<double>9329005.1825</double>
</coords>
</extent>
</gridSet>
</gridSets>
<layers>
<wmsLayer>
<name>airport-cached</name>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG:32630</gridSetName>
<extent>
<coords>
<double>694654.802</double>
<double>5669301.505</double>
<double>700567.404</double>
<double>5672257.806</double>
</coords>
</extent>
</gridSubset>
</gridSubsets>
<wmsUrl>
<string>http://locahost:8080/geoserver/wms</string>
</wmsUrl>
<wmsLayers>airport_group</wmsLayers>
</wmsLayer>
<wmsLayer>
<name>stands-cached</name>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG:32630</gridSetName>
<extent>
<coords>
<double>696573.3</double>
<double>5670483.82</double>
<double>698355.32</double>
<double>5672265.84</double>
</coords>
</extent>
</gridSubset>
</gridSubsets>
<wmsUrl>
<string>http://locahost:8080/geoserver/wms</string>
</wmsUrl>
<wmsLayers>LGW:EGKKStands</wmsLayers>
</wmsLayer>
</layers>
</gwcConfiguration>
Hi,
so the resolutions are calculated (if not set explicitly) when the grid set is defined. Create more wmsLayer instances in the file as shown below, setting xmin,ymin,xmax,ymax for each. Alternatively you can just pick a bounding box that covers all of your layers.
I was hoping to get the CRS extent in GeoServer, so that you don't end up with X different grid sets for the same projection, just haven't gotten there yet. So what you're seeing is that it creates a separate grid set for every layer bounding box.
-Arne
<wmsLayer>
<name>airport-cached</name>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG:32630</gridSetName>
<extent>
<coords>
<double>739505.82</double>
<double>5666250.55</double>
<double>745834.18</double>
<double>5669751.88</double>
</coords>
</extent>
</gridSubset>
</gridSubsets>
....
<wmsLayer>
<name>somethingelse-cached</name>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG:32630</gridSetName>
<extent>
<coords>
<double>xmin</double>
<double>ymin</double>
<double>xmax</double>
<double>ymax</double>
</coords>
</extent>
</gridSubset>
</gridSubsets>
....
Post by Richard Cross
Hi, that was extremely helpful - particularly the GWC Demo, which I hadn't stumbled across in GeoServer yet!
When I looked in there, I noticed that there were entries not only for the "airport-cached" layer I configured in geowebcache.xml, but also for every single layer (and layer group) configured in GeoServer, complete with EPSG:32630. So I'm now wondering whether I really need to create a layer in geowebcache.xml or just create the GridSet?
Also, regarding using the resolutions array from the GWC Demo code for my OpenLayers client: each layer has a different set of resolutions, and combining them together doesn't seem to work. How can I get the right resolution set for my map object when I then want to add two different layers (both served from GWC)?
Regards,
Richard Cross.
Richard Cross
2010-06-25 10:21:19 UTC
Permalink
Thanks, I spotted my error - I hadn't specified any resolutions in my GridSet. It seems to be working now, so thanks for all your help.

Regards,

Richard Cross.
All those Infinity and NaN suggest a bug or an error in the grid that I can't spot right now. You can try changing 0.0 to 0.0000001, but I'll have to look into over the weekend.
-Arne
Post by Richard Cross
Hmm, when I try and view the cached layers I created in geowebcache.xml (below) via the GWC demo, I get a blank screen with no tiles. Have I missed something vital from geowebcache.xml? The OpenLayers client code from GWC follows - the resolutions and maxExtent look a little strange to me.
-- OpenLayers code from GWC Demo page for "stands-cached" from geowebcache below --
<script type="text/javascript">
OpenLayers.DOTS_PER_INCH = 90.71428571428572;
OpenLayers.Util.onImageLoadErrorColor = 'transparent';
var map, layer;
function init(){
var mapOptions = {
resolutions: [Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity],
projection: new OpenLayers.Projection('EPSG:32630'),
maxExtent: new OpenLayers.Bounds(NaN,NaN,NaN,NaN),
units: "meters",
controls: []
};
map = new OpenLayers.Map('map', mapOptions );
map.addControl(new OpenLayers.Control.PanZoomBar({
position: new OpenLayers.Pixel(2, 15)
}));
map.addControl(new OpenLayers.Control.Navigation());
map.addControl(new OpenLayers.Control.Scale($('scale')));
map.addControl(new OpenLayers.Control.MousePosition({element: $('location')}));
var demolayer = new OpenLayers.Layer.WMS(
"stands-cached","../service/wms",
{layers: 'stands-cached', format: 'image/png' },
{ tileSize: new OpenLayers.Size(256,256) }
);
map.addLayer(demolayer);
map.zoomToExtent(new OpenLayers.Bounds(696573.3,5670483.82,698355.32,5672265.84));
}
</script>
-- geowebcache.xml --
<?xml version="1.0" encoding="utf-8"?>
<gwcConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://geowebcache.org/schema/1.2.2/geowebcache.xsd"
xmlns="http://geowebcache.org/schema/1.2.2"
xsi:schemaLocation="http://geowebcache.org/schema/1.2.2 http://geowebcache.org/schema/1.2.2/geowebcache.xsd">
<version>1.2.2</version>
<backendTimeout>120</backendTimeout>
<cacheBypassAllowed>false</cacheBypassAllowed>
<gridSets>
<gridSet>
<name>EPSG:32630</name>
<srs>
<number>32630</number>
</srs>
<extent>
<coords>
<double>166021.4431</double>
<double>0.0</double>
<double>833978.5569</double>
<double>9329005.1825</double>
</coords>
</extent>
</gridSet>
</gridSets>
<layers>
<wmsLayer>
<name>airport-cached</name>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG:32630</gridSetName>
<extent>
<coords>
<double>694654.802</double>
<double>5669301.505</double>
<double>700567.404</double>
<double>5672257.806</double>
</coords>
</extent>
</gridSubset>
</gridSubsets>
<wmsUrl>
<string>http://locahost:8080/geoserver/wms</string>
</wmsUrl>
<wmsLayers>airport_group</wmsLayers>
</wmsLayer>
<wmsLayer>
<name>stands-cached</name>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG:32630</gridSetName>
<extent>
<coords>
<double>696573.3</double>
<double>5670483.82</double>
<double>698355.32</double>
<double>5672265.84</double>
</coords>
</extent>
</gridSubset>
</gridSubsets>
<wmsUrl>
<string>http://locahost:8080/geoserver/wms</string>
</wmsUrl>
<wmsLayers>LGW:EGKKStands</wmsLayers>
</wmsLayer>
</layers>
</gwcConfiguration>
Hi,
so the resolutions are calculated (if not set explicitly) when the grid set is defined. Create more wmsLayer instances in the file as shown below, setting xmin,ymin,xmax,ymax for each. Alternatively you can just pick a bounding box that covers all of your layers.
I was hoping to get the CRS extent in GeoServer, so that you don't end up with X different grid sets for the same projection, just haven't gotten there yet. So what you're seeing is that it creates a separate grid set for every layer bounding box.
-Arne
<wmsLayer>
<name>airport-cached</name>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG:32630</gridSetName>
<extent>
<coords>
<double>739505.82</double>
<double>5666250.55</double>
<double>745834.18</double>
<double>5669751.88</double>
</coords>
</extent>
</gridSubset>
</gridSubsets>
....
<wmsLayer>
<name>somethingelse-cached</name>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG:32630</gridSetName>
<extent>
<coords>
<double>xmin</double>
<double>ymin</double>
<double>xmax</double>
<double>ymax</double>
</coords>
</extent>
</gridSubset>
</gridSubsets>
....
Post by Richard Cross
Hi, that was extremely helpful - particularly the GWC Demo, which I hadn't stumbled across in GeoServer yet!
When I looked in there, I noticed that there were entries not only for the "airport-cached" layer I configured in geowebcache.xml, but also for every single layer (and layer group) configured in GeoServer, complete with EPSG:32630. So I'm now wondering whether I really need to create a layer in geowebcache.xml or just create the GridSet?
Also, regarding using the resolutions array from the GWC Demo code for my OpenLayers client: each layer has a different set of resolutions, and combining them together doesn't seem to work. How can I get the right resolution set for my map object when I then want to add two different layers (both served from GWC)?
Regards,
Richard Cross.
Loading...