0

Is there any control on BBOX to clip the coordinates before sending request to the GeoServer.

The allowed coordinates are [-90, 90, -180,180]. The issue is when ZoomIN/out the BBox calculating the boundaries and sending the request to Geoserver, but when the coordiates are not falling in the allowed range the DB(Mongo) is throwing error.

Ideally, this should be solved at MongoDB plubin but seems the defect is not at fixed.

Looking for an option to do this at openlayers by clipping the coordinates if it falling above or below in the allowed range. So, if we get the control on bbox while page load,zoomin, zoomout and panning then we can do something.

 this.wmsSource = new ImageWMS({
      url: 'http://localhost/geoserver/mongoworkspace/wms',
      params:
      {
        'LAYERS': 'mongoworkspace:sample11',
        'FORMAT': 'image/png8',
        'TILED': false
      },
      serverType: 'geoserver',
      visible: true
    });

  this.wmsLayer = new ImageLayer({
      source: this.wmsSource
      //extent: [-90, -180, 90, 180],
    });

    this.projection = new Projection({
      code: 'EPSG:4326',
      units: 'degrees',
      axisOrientation: 'neu'
    });

    this.view = new OlView({
      center: [0, 0],
      zoom: 1,
      extent: [-90, -180, 90, 180],
      projection: this.projection
    });

    this.map = new Map({
      layers: [
        this.wmsLayer
      ],
      target: 'map',
      view: this.view
    });
  • One possible solution would be to specify extent for your layer. – TomazicM Sep 23 at 17:13
  • I have mentioned this in view "( OlView({ extent: [-179, -89, 179, 89] }) )" but still the request is going like the below ** localhost/geoserver/mongoworkspace/… ** – user3474541 Sep 24 at 6:48
  • Add all the relevant code to your question. Without seeing how you construct your WMS requests it's all just guessing. – TomazicM Sep 24 at 8:48
  • Have updated the code in question section – user3474541 Sep 24 at 9:04
  • It looks like you already tried setting extent on layer. It didn't help? – TomazicM Sep 24 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.