[OpenLayers-Users] "Bad Request" messages
Martin, Will
will.martin at library.und.edu
Thu Sep 13 10:24:22 PDT 2012
I've kept working at it, and the resolutions you've specified below work, but only partially.
I've updated my test case, here:
http://www.libsys.und.edu/dev/p/bygdebok/test.php
The initial screen loads okay, but it behaves erratically as you zoom in. Some zoom levels always work, some levels always fail, and some work only partially:
zoom level 0 = okay
zoom level 1 = okay
zoom level 2 = okay
zoom level 3 = okay
zoom level 4 = BAD
zoom level 5 = okay
zoom level 6 = BAD
zoom level 7 = okay
zoom level 8 = PARTIAL
zoom level 9 = PARTIAL
zoom level 10 = okay
The "partial" levels show up as a mixture of correct map tiles and pink ones.
The pink tiles on the BAD and PARTIAL levels give error messages like these:
400: X,Y values for the tile index were calculated to be {181.999997088,
-24.750002304000002} which had to be rounded to {182, -25} and exceeds
the threshold of 10%. Perhaps the client is using the wrong origin ?
That's from this tile:
http://tinyurl.com/pink-tile-1
Thanks for the help. I appreciate it. At the same time, I wish I didn't have to ask. I mean, this site worked just fine for years without messing around with resolutions or anything. I don't know why it suddenly got so finicky.
Will
-----Original Message-----
From: web [mailto:web at infogeo.ch]
Sent: Wednesday, September 12, 2012 3:51 PM
To: Martin, Will; openlayers-users at lists.osgeo.org
Subject: Re: [OpenLayers-Users] "Bad Request" messages
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,
&n! bsp; 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
More information about the Users
mailing list