GML GetFeatureInfo fails when setting attribute alias

WMS Featureinfo does not work for mime type application/vnd.ogc.gml when configuring attribute alias (Here “bfs nr” for “bfs_nr”):

The returned error message of the GetFeatureInfo request:

error:Translator error Translator error Error reading Features Could not transform 'bfs nr': org.w3c.dom.DOMException: INVALID CHARACTER ERR: An invalid or illegal XML character is specified. An invalid or illegal XML character iS specified.

Should/could the aliasing only be included in the output for humans (text/plain, text/html) and be ignored in the output for machines (other mime types)?

I’m afraid you’re misunderstanding the feature type customization… it’s not some light aliasing that is randomly pickedby some formats and not others, it’s a wholesale redefinition of the data structure, that will be then used in all outputs.

It’s your job to make sure the names are valid for all formats… in your case I’m guessing it’s not working because GetFeatureInfo is being requested as GML?

For sure a space in names will break all WFS usage, and in general, anything that generates XML outputs (which is probably GetFeatureInfo in your case).

Regards,
Andrea Aime

Yep - Requested as application/vnd.ogc.gml and “bfs nr” has space in name. Wholesale change of the datamodel is way to deep for our use case, we would just like to define attribute alias for humans.

As feature type customization goes “to deep”, this can not be achieved through “easy configuration”, correct?

Hum… if you need to perform customizations on a per format and per layer basis, there’s the “features templating” community module:
https://docs.geoserver.org/latest/en/user/community/features-templating/index.html

It can work, but the setup is pretty heavy, it’s not meant to be a simple aliasing for some of the GetFeatureInfo output formats… though it can be used that way, if one wants.

Andrea

But … making an alias is what this is accomplishing :slight_smile:

For the humans you can provide a title (or description) for each attribute
which is allowed to include a space.

Jody Garnett

On Fri, Aug 9, 2024 at 6:17 AM Oliver Jeker via OSGeo Discourse <
noreply@discourse.osgeo.org> wrote:

ojeker https://discourse.osgeo.org/u/ojeker
August 9

Yep - Requested as application/vnd.ogc.gml and “bfs nr” has space in name.
Wholesale change of the datamodel is way to deep for our use case, we would
just like to define attribute alias for humans.

As feature type customization goes “to deep”, this can not be achieved
through “easy configuration”, correct?

Visit Topic
https://discourse.osgeo.org/t/gml-getfeatureinfo-fails-when-setting-attribute-alias/49688/3
or reply to this email to respond.

To unsubscribe from these emails, click here
https://discourse.osgeo.org/email/unsubscribe/e8076db31d150d2637f9754ac1d1ae0e4ddd85faf68b5b0f78ec3003fc6e9999
.

Hi Jody,
it’s true that one can set up a description for each attribute (but not a title).
This description is only visible if one uses the WFS DescribeFeatureType output for that layer, as an annotation in the generated GML schema.

Point in case, here is an example of FeatureInfo output:

https://gs-main.geosolutionsgroup.com/geoserver/topp/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&FORMAT=image%2Fjpeg&TRANSPARENT=true&QUERY_LAYERS=topp%3Astates&STYLES&LAYERS=topp%3Astates&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&INFO_FORMAT=text/xml;%20subtype=gml/3.1.1&FEATURE_COUNT=50&X=50&Y=50&SRS=EPSG%3A4326&WIDTH=101&HEIGHT=101&BBOX=-96.7236328125%2C33.9697265625%2C-87.8466796875%2C42.8466796875

The output points to the schema, which is here:

https://gs-main.geosolutionsgroup.com/geoserver/topp/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=topp%3Astates

As you can see, I’ve customized the description of “STATE_NAME” to be “Name of the state”. So, one could maybe use this as an aliasing mechanism, if they wanted to.

Andrea

Thank you all for replying to this.