0

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.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Sep 2, 2021 at 1:47
1
  • An HTML GetFeatureInfo response is a valid HTML document, that is the only restriction. Commented Sep 10, 2021 at 12:51

1 Answer 1

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.

answered Sep 2, 2021 at 22:33
1
  • 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) Commented Sep 10, 2021 at 12:56

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.