Estoy intentando utilizar los filtros geométricos de Geoserver para mostrar subconjuntos de un gran número de polígonos, pero estoy obteniendo resultados inconsistentes.
Estoy probando sentencias CQL en la página 'Editar Capa' de Geoserver, y viendo mis cambios en una página de previsualización de capas de OpenLayers.
Por ejemplo, el filtro:
BBOX(geom, -11500000, 6500000, -11900000, 7260359)
funciona completamente como se esperaba, sin embargo, los filtros:
BBOX(geom,-11200000, 6100000,-11300000,6200000)
DISJOINT(geom, POLYGON((-11800000 6550000, -11800000 6850000, -11500000 6850000, -11500000 6550000, -11800000 6550000)))
INTERSECTS(geom, POLYGON((-11800000 6550000, -11800000 6850000, -11500000 6850000, -11500000 6550000, -11800000 6550000)))
DWITHIN(geom, POINT(-11800000 6550000),100000,meters)
no producen ningún resultado, a pesar de que todos deberían afectar a algunos polígonos.
Geoserver acepta los filtros como sintácticamente correctos, y no hay errores evidentes en la página, así que estoy realmente perdido en cuanto a por qué estos a veces funcionan y otras veces no.
Salida del registro después de intentarlo:
DWITHIN(geom, POINT(-11800000 6550000), 100000,meters)
2016-08-31 12:42:39,991 TRACE [org.geotools.factory] - ENTRY (CRSAuthorityFactory, CRS_AUTHORITY_FACTORY) 2016-08-31 12:42:39,993 TRACE [org.geotools.factory] - CHECK (CRSAuthorityFactory, CRS_AUTHORITY_FACTORY): user provided a Class. 2016-08-31 12:42:39,993 TRACE [org.geotools.factory] - CHECK (CRSAuthorityFactory, CRS_AUTHORITY_FACTORY): consider hint[last] AbstractEpsgMediator. 2016-08-31 12:42:39,993 TRACE [org.geotools.factory] - THROW (CRSAuthorityFactory, CRS_AUTHORITY_FACTORY): could not find implementation. 2016-08-31 12:42:39,994 DEBUG [org.geotools.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only. 2016-08-31 12:42:39,994 DEBUG [org.geotools.util] - CRSConverterFactory can be applied from Strings to CRS only. 2016-08-31 12:42:40,005 INFO [org.geoserver.gwc] - Saving GeoSeverTileLayer sksoil:polygon_filter_layer 2016-08-31 12:42:44,869 INFO [org.geoserver.wms] - Request: getServiceInfo 2016-08-31 12:42:44,869 DEBUG [org.geotools.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only. 2016-08-31 12:42:44,869 DEBUG [org.geotools.util] - CRSConverterFactory can be applied from Strings to CRS only. 2016-08-31 12:42:44,870 DEBUG [org.geotools.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only. 2016-08-31 12:42:44,870 DEBUG [org.geotools.util] - CRSConverterFactory can be applied from Strings to CRS only. 2016-08-31 12:42:44,870 DEBUG [org.geotools.styling] - number of fts set 1 2016-08-31 12:42:44,873 DEBUG [org.geotools.jdbc] - CREATE CONNECTION 2016-08-31 12:42:44,879 DEBUG [org.geotools.jdbc] - CLOSE CONNECTION 2016-08-31 12:42:44,883 DEBUG [org.geotools.parameter] - Axis length mismatch. 2016-08-31 12:42:44,884 INFO [org.geoserver.wms] - Request: getMap Exceptions = SE_XML Palette = null Tiled = false SRS = EPSG:3857 FeatureVersion = null Styles = [StyleImpl[ name=style_css_polygon]] MaxFeatures = null Layers = [org.geoserver.wms.MapLayerInfo@8db4c08f] Crs = PROJCS["WGS 84 / Pseudo-Mercator", GEOGCS["WGS 84", DATUM["World Geodetic System 1984", SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH], AUTHORITY["EPSG","4326"]], PROJECTION["Popular Visualisation Pseudo Mercator", AUTHORITY["EPSG","1024"]], PARAMETER["semi_minor", 6378137.0], PARAMETER["latitude_of_origin", 0.0], PARAMETER["central_meridian", 0.0], PARAMETER["scale_factor", 1.0], PARAMETER["false_easting", 0.0], PARAMETER["false_northing", 0.0], UNIT["m", 1.0], AXIS["Easting", EAST], AXIS["Northing", NORTH], AUTHORITY["EPSG","3857"]] FormatOptions = {} BgColor = java.awt.Color[r=255,g=255,b=255] Angle = 0.0 Elevation = [] Bbox = SRSEnvelope[-1.22457799832824E7 : -1.12836283302401E7, 6274575.95160879 : 7260359.37192455] ViewParams = null Transparent = false StartIndex = null StyleFormat = sld RemoteOwsType = null RemoteOwsURL = null SldBody = null ValidateSchema = false Sld = null StyleUrl = null CQLFilter = null FeatureId = null Interpolations = [] TilesOrigin = null Env = {} StyleBody = null SldVersion = null StyleVersion = null ScaleMethod = null Width = 749 Height = 768 Filter = null Time = [] Buffer = 0 Format = application/openlayers Filters = null RawKvp = {REQUEST=GetMap, SRS=EPSG:3857, FORMAT=application/openlayers, BBOX=-1.22457799832824E7,6274575.95160879,-1.12836283302401E7,7260359.37192455, VERSION=1.1.0, STYLES=, SERVICE=WMS, WIDTH=749, HEIGHT=768, LAYERS=sksoil:polygon_filter_layer} RequestCharset = UTF-8 Get = true BaseUrl = Version = 1.1.0 Request = GetMap 2016-08-31 12:42:45,895 INFO [org.geoserver.wms] - Request: getServiceInfo 2016-08-31 12:42:45,896 DEBUG [org.geotools.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only. 2016-08-31 12:42:45,896 DEBUG [org.geotools.util] - CRSConverterFactory can be applied from Strings to CRS only. 2016-08-31 12:42:45,896 DEBUG [org.geotools.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only. 2016-08-31 12:42:45,896 DEBUG [org.geotools.util] - CRSConverterFactory can be applied from Strings to CRS only.
... seguido de unas 400 líneas de "CRSConverterFactory sólo se puede aplicar de Strings a CRS", entonces:
2016-08-31 12:42:45,918 DEBUG [org.geotools.rendering] - Processing 1 stylers for [http://sksoil.usask.ca:polygon_filter_layer](http://sksoil.usask.ca:polygon_filter_layer) 2016-08-31 12:42:45,918 DEBUG [org.geotools.rendering] - Expanding rendering area by 2 pixels to consider stroke width 2016-08-31 12:42:45,919 DEBUG [org.geotools.rendering] - Querying layer [http://sksoil.usask.ca:polygon_filter_layer](http://sksoil.usask.ca:polygon_filter_layer) with bbox: ReferencedEnvelope[-1.2684108984285446E7 : -1.0844357212622067E7, 5824706.604963378 : 7710880.386819345] 2016-08-31 12:42:45,920 DEBUG [org.geotools.jdbc] - CREATE CONNECTION 2016-08-31 12:42:45,920 DEBUG [org.geotools.filter] - exporting LogicFilter 2016-08-31 12:42:45,920 DEBUG [org.geotools.filter] - exporting PropertyName 2016-08-31 12:42:45,920 DEBUG [org.geotools.filter] - exporting LiteralExpression 2016-08-31 12:42:45,920 DEBUG [org.geotools.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only. 2016-08-31 12:42:45,920 DEBUG [org.geotools.util] - CRSConverterFactory can be applied from Strings to CRS only. 2016-08-31 12:42:45,921 DEBUG [org.geotools.filter] - exporting PropertyName 2016-08-31 12:42:45,921 DEBUG [org.geotools.filter] - exporting LiteralExpression 2016-08-31 12:42:45,921 DEBUG [org.geotools.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only. 2016-08-31 12:42:45,921 DEBUG [org.geotools.util] - CRSConverterFactory can be applied from Strings to CRS only. 2016-08-31 12:42:45,921 DEBUG [org.geotools.jdbc] - SELECT "skv3_prt_mapunit",encode(ST_AsBinary(CASE WHEN ST_HasArc("geom") THEN "geom" ELSE ST_Simplify(ST_Force2D("geom"), 1951.9912696689369, true) END),'base64') as "geom" FROM (SELECT dss_v3_sk.poly_id, dss_v3_sk.geom, dss_v3_sk.hectares, dss_v3_sk_prt.text1, dss_v3_sk_prt.text2, dss_v3_sk_prt.phsym, dss_v3_sk_prt.pasteros, dss_v3_sk_prt.capblty, dss_v3_sk_prt.stone, dss_v3_sk_prt.zone, dss_v3_sk_prt.deeptill, dss_v3_sk_prt.stsym, dss_v3_sk_prt.sdgr, substr(dss_v3_sk_prt.mapunit::text, 1, 2) AS skv3_prt_mapunit, dss_v3_sk_prt.mapumod, dss_v3_sk_prt.slope_rg, dss_v3_sk_prt.surfex, dss_v3_sk_prt.slpl, dss_v3_sk_prt.irrig, dss_v3_sk_prt.water, dss_v3_sk_prt.wind, dss_v3_sk_prt.salsym FROM public.dss_v3_sk_prt, public.dss_v3_sk WHERE dss_v3_sk_prt.poly_id = dss_v3_sk.poly_id ) as "vtable" WHERE (ST_DWithin("geom",ST_GeomFromText('POINT (-11800000 6550000)', -1),100000.0) AND "geom" && ST_GeomFromText('POLYGON ((-12684108.984285446 5824706.604963378, -12684108.984285446 7710880.386819345, -10844357.212622067 7710880.386819345, -10844357.212622067 5824706.604963378, -12684108.984285446 5824706.604963378))', -1)) 2016-08-31 12:42:45,928 ERROR [org.geotools.jdbc] - Failed to execute statement SELECT "skv3_prt_mapunit",encode(ST_AsBinary(CASE WHEN ST_HasArc("geom") THEN "geom" ELSE ST_Simplify(ST_Force2D("geom"), 1951.9912696689369, true) END),'base64') as "geom" FROM (SELECT dss_v3_sk.poly_id, dss_v3_sk.geom, dss_v3_sk.hectares, dss_v3_sk_prt.text1, dss_v3_sk_prt.text2, dss_v3_sk_prt.phsym, dss_v3_sk_prt.pasteros, dss_v3_sk_prt.capblty, dss_v3_sk_prt.stone, dss_v3_sk_prt.zone, dss_v3_sk_prt.deeptill, dss_v3_sk_prt.stsym, dss_v3_sk_prt.sdgr, substr(dss_v3_sk_prt.mapunit::text, 1, 2) AS skv3_prt_mapunit, dss_v3_sk_prt.mapumod, dss_v3_sk_prt.slope_rg, dss_v3_sk_prt.surfex, dss_v3_sk_prt.slpl, dss_v3_sk_prt.irrig, dss_v3_sk_prt.water, dss_v3_sk_prt.wind, dss_v3_sk_prt.salsym FROM public.dss_v3_sk_prt, public.dss_v3_sk WHERE dss_v3_sk_prt.poly_id = dss_v3_sk.poly_id ) as "vtable" WHERE (ST_DWithin("geom",ST_GeomFromText('POINT (-11800000 6550000)', -1),100000.0) AND "geom" && ST_GeomFromText('POLYGON ((-12684108.984285446 5824706.604963378, -12684108.984285446 7710880.386819345, -10844357.212622067 7710880.386819345, -10844357.212622067 5824706.604963378, -12684108.984285446 5824706.604963378))', -1))