[OpenLayers-Users] "Bad Request" messages
web
web at infogeo.ch
Wed Sep 12 13:51:11 PDT 2012
Hi Martin,
Well, in the example you show you are accessing a tiled service with a WMS. As you know a tiled service has a set a of fixed scales. The tile service is trying to give back tiles based on your WMS request, at a defined resolution. So I interpret the error message you receive like this, "I can't give you back tiles based on the requested resolution (extend), even with a 10% tolerance". So that's it, you have to call the right resolutions (based on the map options). Cool, but how to find out correct resolutions?
I guess the best way would be to call a GetCapabilites on the tile service itself (WMTS). But since you maybe don't know the access point and/or the access point itself may not be public it may not work. If you know the WMTS behind this service, call a GetCapabilities on it, and fill in the resolutions on OpenLayers.
The other way (the ninja one), would be to issue WMS requests and use the error message to find out one correct resolution. (0.000008333) in your example. Then you fill it in (look example below) your OpenLayer's code under the map resolution option. Modify the bbox, get other error messages with other correct resolutions, etc, etc.
I've played a bit around and achieved some correct resolutions:
//Change in your code like this:
map = new OpenLayers.Map("map", {
controls: [],
projection: new OpenLayers.Projection('EPSG:4326'),
resolutions: [
0.0833333,
0.0333333,
0.0166666,
0.00833333,
0.0041666666,
0.001388888,
0.0008333333333333333,
0.00027777777777777776,
0.0001388888888888889,
0.000027777777777777776,
0.000008333333333333332
]
});
//And also a valid center:
map.setCenter(new OpenLayers.LonLat(11.21, 64.21));
You will have some valid zoom with this config.
Hope it helps a lot.
Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120912/575a3f86/attachment.html>
More information about the Users
mailing list