Hi all,

I am using GeoServer with the MongoDB plugin and I am experiencing issues with 
WMS and WMTS where no images are returned on low zoom levels.
The response contains the following error from MongoDB: "longitude/latitude is 
out of bounds"

I discovered that by design MongoDB does not allow intersect queries with 
geometries having coordinates out of the bounding box -180,-90,180,90.
(See the "Important" section from their doc on geoIntersects: 
https://docs.mongodb.com/manual/reference/operator/query/geoIntersects/)

In GeoServer, this becomes problematic in multiple scenarios, where the BBox 
becomes "out of bounds":
* When the clients app requests so. For instance when zooming out the map in 
the "Layer Preview" section of GeoServer, the BBox can become -270,-135,270,135.
  The generated request looks like: 
geoserver/wms?VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&BBOX=-270,-135,270,135&...
* Also, when using WMTS with meta tiling enabled. 
(http://geowebcache.org/docs/1.11.0/concepts/metatiles.html). This enlarges the 
queried BBox of tiles. Which will get "out of bounds" with tiles at the edge. 
This is directly visible at zoom 0 where all tiles are at the edge.
* Again with WMS, GeoServer sometimes enlarges the BBox to fit the height and 
width requested.
  For instance a request with a BBox of -180,-90,180,90 with an image size of 
768x384 will end up in a BBox of -181.875,-91.875, 181.875, 91.875.
  The sent request looks like: 
geoserver/wms?VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&WIDTH=768&HEIGHT=384&BBOX=-180,-90,180,90&...

The associated failing MongoDB query, generated by GeoServer:
{
   <location field>: {
        $geoIntersects: {
            $geometry: {
                type: "Polygon",
                coordinates: [
                    [
                        [ -181.875, -91.875 ],
                        [ -181.875, 91.875 ],
                        [ 181.875, 91.875 ],
                        [ 181.875, -91.875 ],
                        [ -181.875, -91.875 ]
                    ]
                ]
            }
        }
    }
}

The corresponding MongoDB error:
{
   "waitedMS" : NumberLong(0),
   "ok" : 0,
   "errmsg" : "longitude/latitude is out of bounds, lng: -181.875 lat: -91.875",
   "code" : 2
}

Other Store kinds do not mind about an "out of bounds" BBox.
Do you know if I am missing something, or if there is some configuration to 
work around this?
Or should I add some clipping of the BBox in the MongoDB plugin? At least this 
would allow to retrieve the features in the valid part of the BBox.

GeoServer version: 2.12.0
GeoTools version: 18
MongoDB driver version: 3.3.0
MongoDB verison : 3.2.6
OS: OEL

Thank you.

Regards,
Christophe

________________________________

This e-mail is for the sole use of the intended recipient and contains 
information that may be privileged and/or confidential. If you are not an 
intended recipient, please notify the sender by return e-mail and delete this 
e-mail and any attachments. Certain required legal entity disclosures can be 
accessed on our website.<http://site.thomsonreuters.com/site/disclosures/>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to