Hi Ian,

The problem is likely related to the features templating plug in, no problems with the demo layers. All of my other layers on the same server use only app-schema and have no problem with the combination of bbox and json.

Maybe somebody else who has a working layer with features-templating could verify by testing whether they experience the same problem:

Only BBOX works:

.../ows?service=WFS&version=2.0.0&request=GetFeature&typeName=<yourFeaturesTemplatingLayer>&BBOX=18,60,20,65

Only outputFormat json works:

.../ows?service=WFS&version=2.0.0&request=GetFeature&typeName=<yourFeaturesTemplatingLayer>&outputFormat=application/json

Bpth in one query - error:

.../ows?service=WFS&version=2.0.0&request=GetFeature&typeName=<yourFeaturesTemplatingLayer>&BBOX=18,60,20,65&outputFormat=application/json

Henning


On 2024-01-26 16:10, Ian Turton wrote:


On Fri, 26 Jan 2024 at 14:51, Henning Lorenz <henning.lor...@geo.uu.se> wrote:

    Thanks, Julian!

    Your comments helped a lot. With this, the problem is reduced to
    the &BBOX not working in WFS 2.0.0. I went back to OGC
    documentation and started out with a query from the documentation
    - and it works. It turns out that the problem is &BBOX in
    combination with &outputFormat=application/json. Either on its own
    works fine and as expected. Both combined in the query result in a
    java runtime exception "Unable to evaluate template path against
    the template".


That does sound like a bug, can you open a ticket with an example query against one of the demo layers please

Thanks

Ian

    Henning

    On 2024-01-26 14:00, Julian Hollingbery wrote:

    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.

-- Henning Lorenz
    EPOS-Sweden (Swedish participation in EPOS-ERIC;www.epos-se.se  
<http://www.epos-se.se>), infrastructure manager
    Riksriggen data management and support (www.riksriggen.se  
<http://www.riksriggen.se>)
    The Swedish Scientific Drilling Program (www.ssdp.se  <http://www.ssdp.se>)
Uppsala University
    Department of Earth Sciences
    Villavägen 16
    752 36 Uppsala
    Sweden
    mobile: +46 (0) 701 679 320
    e-mail:henning.lor...@geo.uu.se

    _______________________________________________
    Geoserver-users mailing list

    Please make sure you read the following two resources before
    posting to this list:
    - Earning your support instead of buying it, but Ian Turton:
    http://www.ianturton.com/talks/foss4g.html#/
    - The GeoServer user list posting guidelines:
    http://geoserver.org/comm/userlist-guidelines.html

    If you want to request a feature or an improvement, also see this:
    
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


    Geoserver-users@lists.sourceforge.net
    https://lists.sourceforge.net/lists/listinfo/geoserver-users



--
Ian Turton


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.

--
Henning Lorenz
EPOS-Sweden (Swedish participation in EPOS-ERIC;www.epos-se.se), infrastructure 
manager
Riksriggen data management and support (www.riksriggen.se)
The Swedish Scientific Drilling Program (www.ssdp.se)
Uppsala University
Department of Earth Sciences
Villavägen 16
752 36 Uppsala
Sweden
mobile: +46 (0) 701 679 320
e-mail:henning.lor...@geo.uu.se
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to