I’m using Geoserver 2.5.1 with PostGIS 2.1.3 and the ImageMosaic plugin. I have successfully been able to use CQL_FILTER to query a my ImageMosaic layer by time and by my own custom attribute, now I am trying to create a spatial query using something like:
CQL_FILTER=BBOX(the_geom, 48.46, 19.04, 49.4, 19.07)
and the full WMS GetMap request looks like: wms?service=WMS&version=1.1.0&request=GetMap&layers=GeoCenter:gc_mosaic_hd&styles=&bbox=48.4598350524902,19.0338842710851,49.44959107524,19.0846311684303&width=6436&height=330&srs=EPSG:4326&format=application/openlayers&CQL_FILTER=BBOX(the_geom, 48.46, 19.04, 49.4, 19.07)
The raster column created by the ImageMosaic plugin is called “the_geom” and is of type “geometry(Polygon, 4326)”. When I use the GeoServer Layer Preview with OpenLayers and add something like “&CQL_FILTER=BBOX(the_geom, 48, 18, 49, 19)” to the WMS GetMap URL I get no images and the GeoServer log has the below stacktace:
Caused by: org.geotools.data.DataSourceException: Unable to create this mosaic
at org.geotools.gce.imagemosaic.RasterLayerResponse.prepareResponse(RasterLayerResponse.java:1387)
at org.geotools.gce.imagemosaic.RasterLayerResponse.processRequest(RasterLayerResponse.java:1228)
at org.geotools.gce.imagemosaic.RasterLayerResponse.createResponse(RasterLayerResponse.java:1194)
at org.geotools.gce.imagemosaic.RasterManager.read(RasterManager.java:1125)
at org.geotools.gce.imagemosaic.ImageMosaicReader.read(ImageMosaicReader.java:849)
at org.geotools.gce.imagemosaic.ImageMosaicReader.read(ImageMosaicReader.java:828)
at org.geoserver.catalog.SingleGridCoverage2DReader.read(SingleGridCoverage2DReader.java:146)
at org.geoserver.catalog.CoverageDimensionCustomizerReader.read(CoverageDimensionCustomizerReader.java:200)
at org.geoserver.catalog.CoverageDimensionCustomizerReader.read(CoverageDimensionCustomizerReader.java:190)
at org.geoserver.wms.map.RenderedImageMapOutputFormat.readBestCoverage(RenderedImageMapOutputFormat.java:1296)
at org.geoserver.wms.map.RenderedImageMapOutputFormat.directRasterRender(RenderedImageMapOutputFormat.java:861)
… 107 more
Caused by: java.lang.ClassCastException: com.vividsolutions.jts.geom.Envelope cannot be cast to org.geotools.geometry.jts.ReferencedEnvelope
at org.geotools.gce.imagemosaic.Utils$BBOXFilterExtractor.visit(Utils.java:250)
at org.geotools.filter.spatial.BBOXImpl.accept(BBOXImpl.java:216)
at org.geotools.filter.visitor.DefaultFilterVisitor.visit(DefaultFilterVisitor.java:119)
at org.geotools.filter.AndImpl.accept(AndImpl.java:65)
at org.geotools.gce.imagemosaic.catalog.CachingDataStoreGranuleCatalog.getGranuleDescriptors(CachingDataStoreGranuleCatalog.java:152)
at org.geotools.gce.imagemosaic.RasterManager.getGranuleDescriptors(RasterManager.java:1135)
at org.geotools.gce.imagemosaic.RasterLayerResponse.prepareResponse(RasterLayerResponse.java:1336)
… 117 more
According to the GeoServer tutorial http://docs.geoserver.org/stable/en/user/tutorials/cql/cql_tutorial.html the BBOX syntax I am using is valid. I also have a separate vector layer containing the footprints of the granules in the ImageMosaic and the same CQL_FILTER works for that layer.
Can anybody tell me why I would be getting this error? Do spatial queries with CQL_FILTER parameter not apply to an ImageMosaic raster layer?
–Steve