开发者

How does OpenLayers calculate bounding box coordinates?

开发者 https://www.devze.com 2023-03-07 13:44 出处:网络
I\'m trying to display a map using OpenLayers through GeoServer\'s WMS. I\'d like to know how OpenLayers calculates the BBOX coordinates to set them properly with js and avoid the posted error respons

I'm trying to display a map using OpenLayers through GeoServer's WMS. I'd like to know how OpenLayers calculates the BBOX coordinates to set them properly with js and avoid the posted error response. I haven't this issue with OpenStreetMap and GoogleStreetMap.

This is the JavaScript code I used in my function:

function myfunc(display, url){
    var params = {};
    params.layers = 'Italy';
    params.format = 'image/jpeg';
    params.transparent = true;
    var options = {};
    options.projection='EPSG:900913';
    options.displayProjection="EPSG:4326";
    options.maxExtent= new OpenLayers.Bounds(-20037508.34, 20037508.34,20037508.34,20037508.34);
    options.isBaseLayer = true;
    return new OpenLayers.Layer.WMS(display, url, params, options);
}

This is the request to the geoserver:

http://mydomain:myport/geoserver/gwc/service/wms?LAYERS=Italy&FORMAT=image%2Fpng&TRANSPARENT=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&S开发者_JS百科RS=EPSG%3A900913&BBOX=1384430.175625,5152466.50375,1384430.87875,5152467.206875&WIDTH=256&HEIGHT=256

This is the response I'm getting from the geoserver:

400: Resolution (0.00274658203125) is not with 5.0% of the closest grid resolution (0.0023326729820109904)


Try adjusting the map's resolution.


I'm no expert on Geoserver, so apologies if this is trivial.

From what I can gather and guess, this is not an OpenLayers problem, but a Geoserver configuration issue.

It seems like you've set up the "Italy" layer as a precompiled tiled layer, is that correct? And it looks like there is a setting somewhere that determines how close the resolution in a request can be to the preset resolutions in the layer. Could you try some other extent? Maybe "zoom out" a bit? So that your request is closer to the layers resolution?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号