I am serving WMS from MapServer to the Esri JavaScript API client.
Can someone show me what an example of what a response GetFeatureInfo request should look like (how it needs to be formatted)?
The request is sent to the server and the server responds with the appropriate info, but not in the format that the client needs to display it in a popup. My code:
var wmsLayer = new WMSLayer("https://www2.greenwoodmap.com/tetonwy/smartgov-wms", {
format: "png",
resourceInfo: {
extent: new Extent(-180, -90, 180, 90, {wkid: 4326}),
featureInfoFormat: "text/html",
getFeatureInfoURL: "https://myserver.org/wms",
getMapURL: "https://myserver.org/wms",
layerInfos: [
new WMSLayerInfo({
name: "parcels",
title: "parcels",
queryable: true,
showPopup: true
})
],
spatialReferences: [3857,3739],
version: "1.3.0"
},
version: "1.3.0",
visibleLayers: [
"parcels"
]
});
And the response that I'm currently generating:
<?xml version="1.0"?>
<FeatureInfoResponse xmlns:esri_wms="http://www.esri.com/wms" xmlns="http://www.esri.com/wms">
<ParcelInfo id="22-41-17-26-2-00-014"/>
</FeatureInfoResponse>
I have a lot of control over the response, I just need an example of what it should look like so that I can format it accordingly.
-
An HTML GetFeatureInfo response is a valid HTML document, that is the only restriction.nmtoken– nmtoken2021年09月10日 12:51:55 +00:00Commented Sep 10, 2021 at 12:51
1 Answer 1
Apparently I was over thinking this. Simply sending back text or HTML works as I expected it to. I was trying to follow an Esri example that had the response wrapped up XML, which did not display in the popup.
-
I'm unfamiliar with the Esri JavaScript API client but one issue you may face with an HTML GetFeatureInfo response is if the client tries to embed the response in another web page; you can lose any css or js that you have in your HTML page (the response)nmtoken– nmtoken2021年09月10日 12:56:52 +00:00Commented Sep 10, 2021 at 12:56
Explore related questions
See similar questions with these tags.