We could see the below error from GeoServer when zooming out the map, because the bbox sending request more than the MONGO DB accepted range(-180,-90,180,90).

"Query failed with error code 2 and error message 'longitude/latitude is out of bounds"

But our data is within the range, do we need to do any configuration or any workaround.

The below URL is not working:


The below URL is working:


  • what is the exact request you are making? the version of the WFS affects the axis order of 4326
    – Ian Turton
    Commented Sep 19, 2019 at 6:41
  • Have updated both the working and not working request in the question. Commented Sep 19, 2019 at 6:48
  • So the error actually comes from mongodb? If so, the code of the mongodb store should be modified to clip the bounds accordingly. Most data sources don't care actually, so there is no general clipping functionality that applies to all. Commented Sep 19, 2019 at 9:37
  • Yes. Actually, correct place to handle this at MongoDB. Seems the issue is not yet fixed by GeoTools checking for any alternative in openlayers . Basically, we need to clip the coordinates if any one is going out the limits. Is there anyway to get the control of BBox so that we can update these if it is not falling in the range? Commented Sep 19, 2019 at 10:00
  • Well the BBOX extent is definitely wrong in the non-working example. EPSG:4326 is lat long, so 1st and 3rd values should be between +/- 90, and 2nd and 4th value between +/- 180, but the BBOX requested (by OpenLayers?) is BBOX=-127.96875,-255.5859375,127.96875,255.5859375
    – nmtoken
    Commented Nov 7, 2019 at 19:05

1 Answer 1


Try specifying extent in the OpenLayers layer settings (it needs to be in view projection units regardless of the projection the WMS is using)

new ol.layer.Image({
  source: new ol.source.ImageWMS({
  extent: [-180, -90, 180, 90]
  • Have tried below but no luck ` this.wmsLayer = new Image({` source: new ol.source.ImageWMS({ url: 'localhost/geoserver/mongoworkspace/wms', params: { 'LAYERS': 'mongoworkspace:sample11', 'FORMAT': 'image/png8', 'TILED': false }, serverType: 'geoserver', visible: true }), extent: [-180, -90, 180, 90] }); Commented Sep 19, 2019 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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