Hi, I would say that it is very hard or impossible to support generally cascading GetFeatureInfo. If it happens to work it is a reason to be happy. If it does not work then what to blame is the WMS standard itself. GetFeatureInfo is optional and servers can do almost anything with it. Of course if the mime type that the server is using does not match with the data then it is probably a bug. However, the GML alike output from Mapserver is probably well known so it could be supported https://www.mapserver.org/ogc/wms_server.html and test-url https://demo.mapserver.org/cgi-bin/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&BBOX=-11.332970,24.121208,47.584718,57.965035&SRS=EPSG:4326&WIDTH=1001&HEIGHT=575&LAYERS=cities&STYLES=&FORMAT=image/png&TRANSPARENT=true&QUERY_LAYERS=cities&INFO_FORMAT=gml&X=229&Y=280
With Mapserver GetFeatureInfo must be especially configured for each layer separately and having GML as info_format requires some additional steps. That means that normally Mapservers do not support GML. JSON or GeoJSON as info_format is even more hard to configure, though possible. I copied a few excerpts from the WMS 1.3.0 standard to show that GetFeatureInfo is not really designed to support cascading. If is was that at least one common and compulsory INFO_FORMAT had been defined. "GetFeatureInfo is an optional operation. It is only supported for those Layers for which the attribute queryable="1" (true) has been defined or inherited. A client shall not issue a GetFeatureInfo request for other layers. A WMS shall respond with a properly formatted service exception (XML) response (code = OperationNotSupported) if it receives a GetFeatureInfo request but does not support it. The GetFeatureInfo operation is designed to provide clients of a WMS with more information about features in the pictures of maps that were returned by previous Map requests. The canonical use case for GetFeatureInfo is that a user sees the response of a Map request and chooses a point (I,J) on that map for which to obtain more information. The basic operation provides the ability for a client to specify which pixel is being asked about, which layer(s) should be investigated, and what format the information should be returned in. Because the WMS protocol is stateless, the GetFeatureInfo request indicates to the WMS what map the user is viewing by including most of the original GetMap request parameters (all but VERSION and REQUEST). From the spatial context information (BBOX, CRS, WIDTH, HEIGHT) in that GetMap request, along with the I,J position the user chose, the WMS can (possibly) return additional information about that position. The actual semantics of how a WMS decides what to return more information about, or what exactly to return, are left up to the WMS provider. 7.4.3.5 INFO_FORMAT The mandatory INFO_FORMAT parameter indicates what format to use when returning the feature information. Supported values for a GetFeatureInfo request on a WMS server are listed as MIME types in one or more <Request><FeatureInfo><Format> elements of its service metadata. The entire MIME type string in <Format> is used as the value of the INFO_FORMAT parameter. In an HTTP environment, the MIME type shall be set on the returned object using the Content-type entity header. If the request specifies a format not supported by the server, the server shall issue a service exception (code = InvalidFormat). EXAMPLE The parameter INFO_FORMAT=text/xml requests that the feature information be formatted in XML." 7.4.4 GetFeatureInfo response The server shall return a response according to the requested INFO_FORMAT if the request is valid, or issue a service exception otherwise. The nature of the response is at the discretion of the service provider, but it shall pertain to the feature(s) nearest to (I,J). -Jukka Rahkonen- -----Alkuperäinen viesti----- Lähettäjä: Richard Duivenvoorde <rdmaili...@duif.net> Lähetetty: torstai 8. huhtikuuta 2021 16.56 Vastaanottaja: andrea.a...@geo-solutions.it Kopio: Tim Sutton <t...@qgis.org>; GeoServer Mailing List List <geoserver-users@lists.sourceforge.net> Aihe: Re: [Geoserver-users] Cascading WMS ok, but feature info fails? Thanks Andrea, On 4/8/21 3:10 PM, Andrea Aime wrote: > "Not ok" result, it's starting with a tag named "msGMLOutput". > That's not a GML feature collection, just something that looks somehow > similar to it. > We'd need to build a GML parser that's not "schema driven" to parse > that thing (being schema driven means, it follows the structure expected by > the GML during a parse, failing to find it, it returns nothing or throws an > error)... or build a specific one for that output. > A possibly better alternative would be adding support for GeoJSON output in > cascading a FeatureInfo. GeoJSON output would be cool! So: if you ask geojson on geoserver it will also ask geojson on the (cascaded) server? If I am right, that is the Minnesote Mapserver GML? Not 100% sure, but that would also be a good candidate to support. > In anyone is interested in contributing a change, believe it should happen > around here: > https://github.com/geoserver/geoserver/blob/b05e92aa12fb0bf7568d28908d > 88d67d759919ac/src/wms/src/main/java/org/geoserver/wms/featureinfo/WMS > LayerIdentifier.java#L82-L81 > <https://github.com/geoserver/geoserver/blob/b05e92aa12fb0bf7568d28908 > d88d67d759919ac/src/wms/src/main/java/org/geoserver/wms/featureinfo/WM > SLayerIdentifier.java#L82-L81> Would that mean 'just passing' the geojson? Or should it first be deserialized into some JSON object(s)? And then at least fixing the layer/namespace name? ... or not? If anybody is interested in coding this? Let me know, I think I can at least partly fund this. (if nobody is interested I put it on my long list of weekend projects) Would be nice to have some kind of 'crowdfund' site, in which users could throw money at certain (smaller) features... cc Kartoza/Tim Sutton, maybe it is an idea to put this in the 'projecta' project [0] Though I realize that pushing smaller amounts of money over the world is not that easy... Regards, Richard Duivenvoorde [0] https://github.com/qgis/QGIS-Django _______________________________________________ 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 _______________________________________________ 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