Hi,
You are mixing parameters between different versions of OGC
protocols, and this is causing at least some of your issues.
* &maxfeatures is a WFS version 1.x parameter. It should not do
anything in a WMS request. For WFS 2.0.0, the corresponding
parameter is called &count.
* &filter is technically only a WFS-parameter, so for it to
work in WMS is a non-standard feature in GeoServer.
/Julian
*From:*Henning Lorenz <henning.lor...@geo.uu.se>
<mailto:henning.lor...@geo.uu.se>
*Sent:* Thursday, 25 January 2024 11.16
*To:* geoserver-users@lists.sourceforge.net
*Subject:* [Geoserver-users] Features-templating and OGC
services, filters not working, errors
Geoserver 2.24 and 2.21 snapshot with module app-schema and
community modules features templating, ogcapi-features (all from
same build date)
Hello,
I have set up a seemingly functional layer with features
templating. However, I encounter a rather odd behaviour when I
try to include filters in the query URLs. Here is a summary (I
paste examples below):
WMS 1.3 requests: Simple GetMap request works. &maxFeatures
works. CQL-filters do not work. OGC-filters on attributes work.
Spatial OGC-filter returns an empty map.
WFS 2.0.0 query: Simple Get Feature query works. &maxFeatures has
no effect. &bbox returns an error. CQL filters do not work.
OGC-filters on attributes work. Spatial OGC-filter returns error.
No spatial filtering at all, no CQL filters, only OGC filters on
attributes work. This limits the usefulness of WMS, and WFS is
almost completely useless. I guess that something is wrong, but
do not even know where to start looking for the problem, assuming
that there is a common underlying problem. The log entries are
very peculiar - not much with CQL-filter errors. On the other
hand, extensive warnings that the OGC-filter - which actually
works - could not be parsed. java.lang.RuntimeException on the
spatial filter errors (java.lang.NullPointerException on OGC
filter; Unable to evaluate template path against the template on
bbox).
The main issue is that spatial filtering is not working (either
no effect or returns error) while all features are displayed in
the correct locations in a basic WMS map. Very peculiar is also
that basic limitations like maxFeatures do not work, as it has
nothing to do with the actual content. Any ideas on how to
proceed with troubleshooting are very much appreciated.
Thank you and best wishes,
Henning
---------------
Below the tested queries with short comments:
WMS 1.3:
Requesting a map without any additional parameters works as expected:
http://localhost:8080/geoserver/eposgo/wms?service=WMS&version=1.3.0&request=GetMap&layers=eposgo:MagnetotelluricStationsFeature&bbox=62,21,65,26&width=700&height=600&srs=EPSG:4326&format=image/jpeg
<http://localhost:8080/geoserver/eposgo/wms?service=WMS&version=1.3.0&request=GetMap&layers=eposgo:MagnetotelluricStationsFeature&bbox=62,21,65,26&width=700&height=600&srs=EPSG:4326&format=image/jpeg>
maxFeatures works:
http://localhost:8080/geoserver/eposgo/wms?service=WMS&version=1.3.0&request=GetMap&layers=eposgo:MagnetotelluricStationsFeature&maxFeatures=5&bbox=62,21,65,26&width=700&height=600&srs=EPSG:4326&format=image/jpeg
<http://localhost:8080/geoserver/eposgo/wms?service=WMS&version=1.3.0&request=GetMap&layers=eposgo:MagnetotelluricStationsFeature&maxFeatures=5&bbox=62,21,65,26&width=700&height=600&srs=EPSG:4326&format=image/jpeg>
CQL-filter on an attribute does not work (displays map with all
features, unfiltered, as without filter):
http://localhost:8080/geoserver/eposgo/wms?service=WMS&version=1.3.0&request=GetMap&layers=eposgo:MagnetotelluricStationsFeature&bbox=62,21,65,26&width=700&height=600&srs=EPSG:4326&CQL-FILTER=surveyname='1998'&format=image/jpeg
<http://localhost:8080/geoserver/eposgo/wms?service=WMS&version=1.3.0&request=GetMap&layers=eposgo:MagnetotelluricStationsFeature&bbox=62,21,65,26&width=700&height=600&srs=EPSG:4326&CQL-FILTER=surveyname='1998'&format=image/jpeg>
OGC-filter on an attribute works as expected:
http://localhost:8080/geoserver/eposgo/wms?service=WMS&version=1.3.0&request=GetMap&layers=eposgo:MagnetotelluricStationsFeature&bbox=62,21,65,26&width=700&height=600&srs=EPSG:4326&FILTER=
<http://localhost:8080/geoserver/eposgo/wms?service=WMS&version=1.3.0&request=GetMap&layers=eposgo:MagnetotelluricStationsFeature&bbox=62,21,65,26&width=700&height=600&srs=EPSG:4326&FILTER=><Filter
xmlns="http://www.opengis.net/ogc" <http://www.opengis.net/ogc>
xmlns:gml="http://www.opengis.net/gml"
<http://www.opengis.net/gml>><PropertyIsEqualTo><PropertyName>surveyname</PropertyName><Literal>1998</Literal></PropertyIsEqualTo></Filter>&format=image/jpeg
OGC spatial filter returns empty map (tested with both latlon and
lonlat, as the order of coordinates in different
formats/standards (and their combination) always appears to be a
mess to me)
http://localhost:8080/geoserver/eposgo/wms?service=WMS&version=1.3.0&request=GetMap&layers=eposgo:MagnetotelluricStationsFeature&bbox=62,21,65,26&width=700&height=600&srs=EPSG:4326&FILTER=
<http://localhost:8080/geoserver/eposgo/wms?service=WMS&version=1.3.0&request=GetMap&layers=eposgo:MagnetotelluricStationsFeature&bbox=62,21,65,26&width=700&height=600&srs=EPSG:4326&FILTER=><Filter
xmlns="http://www.opengis.net/ogc" <http://www.opengis.net/ogc>
xmlns:gml="http://www.opengis.net/gml"
<http://www.opengis.net/gml>><Contains><PropertyName>geometry</PropertyName><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>24
62 26 62 26 65 24 65 24
62</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></Contains></Filter>&format=image/jpeg
http://localhost:8080/geoserver/eposgo/wms?service=WMS&version=1.3.0&request=GetMap&layers=eposgo:MagnetotelluricStationsFeature&bbox=62,21,65,26&width=700&height=600&srs=EPSG:4326&FILTER=
<http://localhost:8080/geoserver/eposgo/wms?service=WMS&version=1.3.0&request=GetMap&layers=eposgo:MagnetotelluricStationsFeature&bbox=62,21,65,26&width=700&height=600&srs=EPSG:4326&FILTER=><Filter
xmlns="http://www.opengis.net/ogc" <http://www.opengis.net/ogc>
xmlns:gml="http://www.opengis.net/gml"
<http://www.opengis.net/gml>><Contains><PropertyName>geometry</PropertyName><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>62
24 62 26 65 26 65 24 62
24</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></Contains></Filter>&format=image/jpeg
WFS 2.0:
Query for all features works as expected:
localhost:8080/geoserver/eposgo/ows?service=WFS&version=2.0.0&request=GetFeature&typeName=eposgo:MagnetotelluricStationsFeature&outputFormat=application/json
maxFeatures does not work, the query returns all features:
localhost:8080/geoserver/eposgo/ows?service=WFS&version=2.0.0&request=GetFeature&typeName=eposgo:MagnetotelluricStationsFeature&maxFeatures=10&outputFormat=application/json
Filtering the query by an inline bbox results in an
<ows:Exception exceptionCode="NoApplicableCode"></ows:Exception>
(from Geoserver log: "java.lang.RuntimeException: Unable to
evaluate template path against the template"):
localhost:8080/geoserver/eposgo/ows?service=WFS&version=2.0.0&request=GetFeature&typeName=eposgo:MagnetotelluricStationsFeature&BBOX=62,21,65,26,EPSG:4326&outputFormat=application/json
Spatial filtering the query by a CQL-BBOX does not work, it
returns all features:
localhost:8080/geoserver/eposgo/ows?service=WFS&version=2.0.0&request=GetFeature&typeName=eposgo:MagnetotelluricStationsFeature&CQL-FILTER=BBOX(62,21,65,26)&outputFormat=application/json
Spatial filtering the query with an OGC BOX or Contains returns
<ows:Exception exceptionCode="NoApplicableCode"></ows:Exception>
(java.lang.NullPointerException):
localhost:8080/geoserver/eposgo/ows?service=WFS&version=2.0.0&request=GetFeature&typeName=eposgo:MagnetotelluricStationsFeature&FILTER=<Filter
xmlns="http://www.opengis.net/ogc" <http://www.opengis.net/ogc>
xmlns:gml="http://www.opengis.net/gml"
<http://www.opengis.net/gml>><BBOX><PropertyName>geometry</PropertyName><gml:coord><gml:X>21</gml:X><gml:Y>62</gml:Y></gml:coord><gml:coord><gml:X>26</gml:X><gml:Y>65</gml:Y></gml:coord></gml:Box></BBOX></Filter>&outputFormat=application/json
localhost:8080/geoserver/eposgo/ows?service=WFS&version=2.0.0&request=GetFeature&typeName=eposgo:MagnetotelluricStationsFeature&FILTER=<Filter
xmlns="http://www.opengis.net/ogc" <http://www.opengis.net/ogc>
xmlns:gml="http://www.opengis.net/gml"
<http://www.opengis.net/gml>><Contains><PropertyName>geometry</PropertyName><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>21
62 26 62 26 65 21 65 21
62</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></Contains></Filter>&outputFormat=application/json
CQL-Filter on an attribute does not work, it returns all features:
localhost:8080/geoserver/eposgo/ows?service=WFS&version=2.0.0&request=GetFeature&typeName=eposgo:MagnetotelluricStationsFeature&CQL-FILTER=surveyname='1998'&outputFormat=application/json
OGC-filter on an attribute works as expected:
localhost:8080/geoserver/eposgo/ows?service=WFS&version=2.0.0&request=GetFeature&typeName=eposgo:MagnetotelluricStationsFeature&FILTER=<Filter
xmlns="http://www.opengis.net/ogc" <http://www.opengis.net/ogc>
xmlns:gml="http://www.opengis.net/gml"
<http://www.opengis.net/gml>><PropertyIsEqualTo><PropertyName>surveyname</PropertyName><Literal>1998</Literal></PropertyIsEqualTo></Filter>&outputFormat=application/json
När du har kontakt med oss på Uppsala universitet med e-post så
innebär det att vi behandlar dina personuppgifter. För att läsa
mer om hur vi gör det kan du läsa här:
http://www.uu.se/om-uu/dataskydd-personuppgifter/
E-mailing Uppsala University means that we will process your
personal data. For more information on how this is performed,
please read here:
http://www.uu.se/en/about-uu/data-protection-policy
VARNING: Klicka inte på länkar och öppna inte bilagor om du inte
känner igen avsändaren och vet att innehållet är säkert.
CAUTION: Do not click on links or open attachments unless you
recognise the sender and know the content is safe.