01-28-2019 04:25 PM
Hi,
I wonder if it is possible to add a new format on my wms publish via GeoMedia WebMap.
On my WMS getCapabilities I have the following formats for getfeatureinfo:
<GetFeatureInfo> <Format>text/xml</Format> <Format>text/html</Format> <Format>application/gml+xml; version=3.1</Format> ... </GetFeatureInfo>
It would be really good if it I could add the JSON format - "application/json"? Is this possible?
Thank you.
Solved! Go to Solution.
01-29-2019 01:05 AM
Hi,
I think WebMap cannot do this out of the box, however, it could perhaps be possible somehow by adding a XML to JSON XSL transformation to the service XMLTemplates. But if you can control your client consuming the service, it would perhaps be easier to implement a JavaScript XML to JSON transformation.
Pavel
01-29-2019 01:20 AM
The main problem is that WebMap's WMS won't understand GetFeatureInfo with format=application/json even if you force it display in the capabilities. One ugly work-around would be to use format=text/html but instead of HTML serve JSON via the XSLT which Pavel mentioned.
Much better solution would be to add a custom GetFeatureInfo handler via a custom passthrough pipe which would:
01-29-2019 11:52 AM
In fact, I am using WebMap for publishing WMS and WFS only.
Yes,
in fact as you said I am doing the transformation on the client side. Knowing that webmap can build OGC WMS it would be nice to have the possibility to allow json format on getfeatureinfo method as it turns things much easy when you want to operate with multiple applications. By the way there Is any in Hexagon Community where I may suggestions improvements for new versions?
Thank you.
01-29-2019 12:01 PM - edited 01-29-2019 12:03 PM
Here is our Ideation Guidelines page on everything you need to know about submitting product ideas:
https://community.hexagongeospatial.com/t5/About-the-Community/Ideation-guidelines/ba-p/16696
02-05-2019 05:49 AM
I decided to write a How-To article on this topic:
02-06-2019 12:18 PM
Thank you Jan for this!
02-07-2019 05:15 AM
Hi Jan!
We've got a similar request from our customer. He asks for WMS <GetFeatureInfo> in this format: application/vnd.ogc.gml
Could you pls advise how to manage this?
Thanks a lot,
Kirill
02-07-2019 06:24 AM
Hi Kirill,
I don't see much sense requesting this format because WebMap's GetFeatureInfo is already a GML XML file, i.e. text/xml returns GML FeatureCollection.
If the customer still needs a WMS to work with this MIME type, then it is only required to create simple pass-through pipe, that will change the application/gml+xml; version=3.1 to text/xml and back internally. Something like this:
public IResponseBase GetFeatureInfoHandler(SDIMethodParameters parameters, AdditionalParametersCollection additionalParameters, IUserContext userContext) { IResponseBase response = null; if (parameters is GetFeatureInfoParameters130 fi130) { if (fi130.InfoFormat == "application/gml+xml; version=3.1") { fi130.InfoFormat = "text/xml"; response = InvokeOnNextPipe(parameters, additionalParameters, userContext); response.MimeType = "application/gml+xml; version=3.1"; return resultResponse; } } response = InvokeOnNextPipe(parameters, additionalParameters, userContext); return response; }