Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InfoClick (new version) Get infoclick working for ArcGIS Server, and (myCarta Server) #1266

Closed
eri-blan opened this issue Jan 17, 2023 · 12 comments
Assignees
Labels
module:client/core Core functionality (not a plugin) new feature Request for adding/changing functionality
Milestone

Comments

@eri-blan
Copy link

eri-blan commented Jan 17, 2023

Describe the bug
Infoclick for some WMS-Servers does not work with the new InfoClick.

To Reproduce

I provide a few open WMS-services to test with:

ArcGIS Server
https://ext-geodata-nationella.lansstyrelsen.se/arcgis/services/LST/lst_wms_miljodata/MapServer/WMSServer?
application/geojson is advertised but does not seem to work. text/xml gives an xml response but is not shown in InfoClick.
It might be that it works depending on the ArcGIS Server-version.

Example response:

<?xml version="1.0" encoding="UTF-8"?>
<FeatureInfoResponse
	xmlns:esri_wms="http://www.esri.com/wms"
	xmlns="http://www.esri.com/wms">
	<FIELDS OBJECTID="13564" Kommun="ÖREBRO" Object_Id="114519" N_SWEREF99="6570152" E_SWEREF99="512219" AntalFastigheter="1" Status="Inventering" RiskKlass="3" PreciseradStatus="Null" Lan="ÖREBRO LÄN" PrimarBransch="Kemtvätt - med lösningsmedel" SekundarBransch="Null"></FIELDS>
</FeatureInfoResponse>

There has been an effort made to make ArcGIS Server GetFeatureInfo-respones to work with the old InfoClick, see #1256

myCarta Server
https://karta.orebro.se/mycartaserver/externkarta2.wms?
Does not seem to support application/json from the start. However application/vnd.geo+json ang gives a response result but does not show upp in InfoClick. Same with text/xml.

There is already an issue about this #1147

Example responses:

{
    "type": "FeatureCollection",
    "features": [{
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [164811.591, 6571372.183]
            },
            "properties": {
                "ID": "204878",
                "TITEL": "På Universitetsgatan mittemot Tybblelundshallen",
                "BESKRIVNING": "Betalstation för vatten, På Universitetsgatan mittemot Tybblelundshallen",
                "LINK": "http://www.orebro.se/42320.html"
            }
        }
    ]
}
<?xml version="1.0" encoding="utf-8"?>
<FeatureCollection
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://www.mycarta.se/gml"
	xmlns:gml="http://www.opengis.net/gml"
	xmlns:xlink="http://www.w3.org/1999/xlink">
	<gml:featureMember>
		<Betalstationer_för_vatten>
			<ID>204878</ID>
			<TITEL>På Universitetsgatan mittemot Tybblelundshallen</TITEL>
			<BESKRIVNING>Betalstation för vatten, På Universitetsgatan mittemot Tybblelundshallen</BESKRIVNING>
			<LINK>http://www.orebro.se/42320.html</LINK>
		</Betalstationer_för_vatten>
	</gml:featureMember>
</FeatureCollection>

Carmenta Server
https://geo-netinfo.trafikverket.se/MapService/wms.axd/NetInfo_1_1?
Seems to work somewhat well, both application/json and text/xml.

Example responses:

<?xml-stylesheet type="text/xsl" href="" ?>
<cab:FeatureCollection
	xmlns:gml="http://www.opengis.net/gml"
	xmlns:gmlsf="http://www.opengis.net/gmlsf"
	xmlns:xlink="http://www.w3.org/1999/xlink"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.carmenta.com/cab https://geo-netinfo.trafikverket.se/mapservice/wfs.axd/NetInfo_1_1?service=WFS&amp;request=DescribeFeatureType&amp;version=1.1.0" numberOfFeatures="2" timeStamp="2023-01-13T14:11:22Z"
	xmlns:cab="http://www.carmenta.com/cab">
	<gml:boundedBy>
		<gml:Envelope srsName="urn:ogc:def:crs:EPSG::3009">
			<gml:lowerCorner>6572319.313428493 160270.14101197638</gml:lowerCorner>
			<gml:upperCorner>6572351.4865809735 160298.25412986032</gml:upperCorner>
		</gml:Envelope>
	</gml:boundedBy>
	<gml:featureMember>
		<cab:Vagtrafiknat gml:id="Vagtrafiknat.1725.908239">
			<gml:boundedBy
				xmlns:xsd="http://www.w3.org/2001/XMLSchema">
				<gml:Envelope srsName="urn:ogc:def:crs:EPSG::3009">
					<gml:lowerCorner>6572343.985596358 160285.89735894528</gml:lowerCorner>
					<gml:upperCorner>6572351.4865809735 160298.25412986032</gml:upperCorner>
				</gml:Envelope>
			</gml:boundedBy>
			<cab:curveProperty>
				<gml:Curve
					xmlns:xsd="http://www.w3.org/2001/XMLSchema" srsName="urn:ogc:def:crs:EPSG::3009">
					<gml:segments>
						<gml:LineStringSegment>
							<gml:posList>6572351.4866 160298.25413 6572348.4104 160293.91957 6572343.9856 160285.89736</gml:posList>
						</gml:LineStringSegment>
					</gml:segments>
				</gml:Curve>
			</cab:curveProperty>
			<cab:Nattyp>1</cab:Nattyp>
			<cab:NattypDescription>bilnät</cab:NattypDescription>
			<cab:VALID_FROM>20010401</cab:VALID_FROM>
			<cab:VALID_TO>99991231</cab:VALID_TO>
			<cab:CAB_V>0</cab:CAB_V>
		</cab:Vagtrafiknat>
	</gml:featureMember>
	<gml:featureMember>
		<cab:Vagtrafiknat gml:id="Vagtrafiknat.1725.917054">
			<gml:boundedBy
				xmlns:xsd="http://www.w3.org/2001/XMLSchema">
				<gml:Envelope srsName="urn:ogc:def:crs:EPSG::3009">
					<gml:lowerCorner>6572319.313428493 160270.14101197638</gml:lowerCorner>
					<gml:upperCorner>6572343.985596358 160286.10444177917</gml:upperCorner>
				</gml:Envelope>
			</gml:boundedBy>
			<cab:curveProperty>
				<gml:Curve
					xmlns:xsd="http://www.w3.org/2001/XMLSchema" srsName="urn:ogc:def:crs:EPSG::3009">
					<gml:segments>
						<gml:LineStringSegment>
							<gml:posList>6572319.3134 160270.14101 6572320.1701 160275.93437 6572324.3647 160283.7565 6572329.8229 160286.10444 6572343.9856 160285.89736</gml:posList>
						</gml:LineStringSegment>
					</gml:segments>
				</gml:Curve>
			</cab:curveProperty>
			<cab:Nattyp>1</cab:Nattyp>
			<cab:NattypDescription>bilnät</cab:NattypDescription>
			<cab:VALID_FROM>20010401</cab:VALID_FROM>
			<cab:VALID_TO>99991231</cab:VALID_TO>
			<cab:CAB_V>0</cab:CAB_V>
		</cab:Vagtrafiknat>
	</gml:featureMember>
</cab:FeatureCollection>
{
    "type": "FeatureCollection",
    "crs": {
        "type": "name",
        "properties": {
            "name": "urn:ogc:def:crs:EPSG::3009"
        }
    },
    "features": [{
            "type": "Feature",
            "id": "Vagtrafiknat.4309.917054",
            "properties": {
                "Nattyp": 1,
                "NattypDescription": "bilnät",
                "VALID_FROM": 20010401,
                "VALID_TO": 99991231,
                "CAB_V": "0"
            },
            "geometry": {
                "type": "LineString",
                "coordinates": [[6572318.9101, 160259.51364], [6572319.1407, 160268.97259], [6572320.1701, 160275.93437], [6572324.3647, 160283.7565], [6572329.8229, 160286.10444], [6572341.8865, 160285.92805]]
            },
            "crs": {
                "type": "name",
                "properties": {
                    "name": "urn:ogc:def:crs:EPSG::3009"
                }
            }
        }
    ]
}

Expected behavior
Information from GetFeatureInfo is shown in InfoClick (new version)

@jacobwod
Copy link
Member

Thanks for a nice issue description!

ArcGIS Server https://ext-geodata-nationella.lansstyrelsen.se/arcgis/services/LST/lst_wms_miljodata/MapServer/WMSServer? application/geojson is advertised but does not seem to work. text/xml gives an xml response but is not shown in InfoClick. It might be that it works depending on the ArcGIS Server-version.

Regarding #1256: it's correct that this issue persists in develop at time of writing. I'm looking into this, which involves the new parser #parseWmsGetFeatureInfoXml, by @linusfj. Can you, @linusfj, check the example WMS (URL above) and see if you can reproduce. It looks as #parseWmsGetFeatureInfoXml doesn't work as intended after all and if I recall correctly, you use the same method in Click.js for the old infoclick to. Mind taking a look?

@jacobwod
Copy link
Member

There is a big problem with those ArcGIS layers: they do not indicate which of the requested layers the respond feature belongs to. See this example:

https://ext-geodata-nationella.lansstyrelsen.se/arcgis/services/LST/lst_wms_miljodata/MapServer/WMSServer?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&FORMAT=image/png&TRANSPARENT=true&QUERY_LAYERS=LST_Biotopkartering_vandringshinder_for_oring,LST_Biotopkartering_vandringshinder&LAYERS=LST_Biotopkartering_vandringshinder_for_oring,LST_Biotopkartering_vandringshinder&INFO_FORMAT=text/xml&SRS=EPSG:3008&TILED=false&STYLES=,&FEATURE_COUNT=100&X=179&Y=42&WIDTH=256&HEIGHT=256&BBOX=112019.7168,6279803.84184,115603.7168,6283387.84184

Requests goes out to two layers (LAYERS=LST_Biotopkartering_vandringshinder_for_oring,LST_Biotopkartering_vandringshinder). We get a response. (Try it out yourself in the browser.)

But there's no way (as far as I can tell) to see if the resulting feature comes from layer A or B:

<?xml version="1.0" encoding="UTF-8"?>
<FeatureInfoResponse xmlns:esri_wms="http://www.esri.com/wms" xmlns="http://www.esri.com/wms">
    <FIELDS OBJECTID="8536" VHID="64616" URL="https://biotopkartering.lansstyrelsen.se/frmVandringshinder.aspx?VandringshinderID=64616" VHnamn="Null" VHNkoord="6282090" VHEkoord="372588" VHtyp="damm" KombMedVag="Null" LokalBeskr="Fyllinge kvarn" VHlopnr="1" UndNamn="H15" InvDatum="2007-09-20" FallhTot="Null" FallhUtn="Null" Naturl_VH="Nej" DammLangd="Null" DammBredd="Null" Torrfara="Nej" TorrfaraL="Null" FlodeUppsk="12" VForKlass="M" UtskTrAnt="Null" TrumLangd="Null" TrumDiam="Null" TrumLutn="Null" TrumBmtrl="Null" TrumFallh="Null" TrumPolNed="Nej" TrumHast="Null" TrumDjUtl="Null" TrumFriAnd="Null" Fingrind="ja" TrumDjup="Null" ForMort="Definitivt" ForOring="Passerbart" ForAlyngel="Null" ForAl="Null" Skador="Nej" AnvIdag="Null" AndTidig="Kvarn" KulturHind="Ja" KulturByggn="Null" VagTillVH="Ja" Fiskvag="Ja" FiskvagID="Null" FiskvFunkt="fungerar" Atgarder="Null" Kommentar="Elproduktion/Skiss finns/inga, trappa finns redan och fungerar" InmDatum="2013-06-03 14:07:02" AndrDatum="2013-06-03 14:24:28" AndrBeskr="Ändrat vattendrag till Fylleån" Vdragnamn="Fylleån" HaroNr="100" EU_CD="Null" VattenplatsID="8267" NarmasteVattenforekomstEUID="SE628804-132692" LiggerIVattenforekomsten="Ja" OvrigtVattenEUID="Null" VersionVattenforekomst="SVAR_2012_2" Shape="Point"></FIELDS>
    <FIELDS OBJECTID="8536" VHID="64616" URL="https://biotopkartering.lansstyrelsen.se/frmVandringshinder.aspx?VandringshinderID=64616" VHnamn="Null" VHNkoord="6282090" VHEkoord="372588" VHtyp="damm" KombMedVag="Null" LokalBeskr="Fyllinge kvarn" VHlopnr="1" UndNamn="H15" InvDatum="2007-09-20" FallhTot="Null" FallhUtn="Null" Naturl_VH="Nej" DammLangd="Null" DammBredd="Null" Torrfara="Nej" TorrfaraL="Null" FlodeUppsk="12" VForKlass="M" UtskTrAnt="Null" TrumLangd="Null" TrumDiam="Null" TrumLutn="Null" TrumBmtrl="Null" TrumFallh="Null" TrumPolNed="Nej" TrumHast="Null" TrumDjUtl="Null" TrumFriAnd="Null" Fingrind="ja" TrumDjup="Null" ForMort="Definitivt" ForOring="Passerbart" ForAlyngel="Null" ForAl="Null" Skador="Nej" AnvIdag="Null" AndTidig="Kvarn" KulturHind="Ja" KulturByggn="Null" VagTillVH="Ja" Fiskvag="Ja" FiskvagID="Null" FiskvFunkt="fungerar" Atgarder="Null" Kommentar="Elproduktion/Skiss finns/inga, trappa finns redan och fungerar" InmDatum="2013-06-03 14:07:02" AndrDatum="2013-06-03 14:24:28" AndrBeskr="Ändrat vattendrag till Fylleån" Vdragnamn="Fylleån" HaroNr="100" EU_CD="Null" VattenplatsID="8267" NarmasteVattenforekomstEUID="SE628804-132692" LiggerIVattenforekomsten="Ja" OvrigtVattenEUID="Null" VersionVattenforekomst="SVAR_2012_2" Shape="Point"></FIELDS>
</FeatureInfoResponse>

(In addition, we seem to get a duplicate of the same feature… but that's another issue and nothing we can fix on our end.)

And if we can't match a feature to a layer, there's no way to know which infoclick definition should be used.

Any ideas on how we can tackle those responses, @eri-blan @linusfj @Hallbergs?

@eri-blan
Copy link
Author

Here is another result from Skogsstyrelsen:

https://geodpags.skogsstyrelsen.se/arcgis/services/Geodataportal/GeodataportalVisaSkoghistoria/MapServer/WmsServer?

<?xml version="1.0" encoding="UTF-8"?>

<FeatureInfoResponse xmlns:esri_wms="http://www.esri.com/wms" xmlns="http://www.esri.com/wms">
<FIELDS objectid="1018605" Shape="Polygon" Objektnr="34206" LanKod="18" Lan="ÖREBRO LÄN" KommunKod="1880" Kommun="ÖREBRO" Sakord="83 - Lägenhetsbebyggelse" Datinv="1997-08-22" Beskrivnin="Torplämning, ca 225x70 m (VNV-ÖSÖ), bestående av 1) Husgrund, 5x4 m (Ö-V), av 0,3-0,7m st stenar. Spismurrest i SÖ, 2x2m, 0,3m h, av tegelrester. 5 m N om 1) är 2) Stengärdesgård, 200 m l (Ö-V), 0,7-1,3 m h, 1,2 m br, 0,1-1,0 m st stenar. I stengärdesgården finns  2 öppningar för skogsvägar. 110 m Ö om 1) är 3) Stengärdesgård, 15 m l (VNV-OSO), 1,0-1,5 m h, 1,5 m br, av 0,3-0,7 m st stenar. 20 m ÖSÖ om 1) är 4) Jordkällare, 7x5 m (Ö-V), 2,5 m l stensatt gång, 1,0 m br och 0,4-0,7 m h jordvallar. 30 m NÖ om 1) är 5) Jordkällare, stensatt, 7x5 m (Ö-V), 1,8 m h, 1,4 m br, av 0,3-0,9 m st stenar. öppning i V. 70 m N och NÖ om 1) är 6) Stengärdesgårdar, 30 resp. 15 m l (NV-SÖ), 35 m l öppning mellan murarna, 0,5-0,8 m b, 0,5-0,8 m h, 0,2-1,0 m st stenar. I området finns enstaka röjningsrösen." Kultprveg="4 - Nej" Traditio="Se inventerarens kommentar" Lamnnamn="Stenbacken" GammaltID="1880082427" Registerstatus="1 - Inventerad"></FIELDS>
<FIELDS Objectid="3057892" Shape="Point" Objektnr="34207" LanKod="18" Lan="ÖREBRO LÄN" KommunKod="1880" Kommun="ÖREBRO" Sakord="70 - Kemisk industri" Datinv="1997-08-22" Beskrivnin="1) Tjärdal/tjärgrop, 3,0 m i diam, 0,7 m h, av 0,3-0,7 m st stenar. Öppning i botten 0,3 m i diam. Avtappningsränna i VNV, 3 m l, 0,5 m br." Kultprveg="4 - Nej" Traditio="Se inventerarens kommentar" Lamnnamn="Null" GammaltID="1880082428" Registerstatus="1 - Inventerad"></FIELDS>
</FeatureInfoResponse>

@jacobwod
Copy link
Member

I've managed to get this working for the new MapClickModel, including showing a layer name and having layer-specific infoclick definitions.

Still no feature geometry, but it's nowhere to be seen in the response, so not much to do.

I'll add this fix, as well as a new infoclick format type to Admin UI:
Skärmavbild 2023-01-18 kl  12 20 09

Skärmavbild 2023-01-18 kl  12 18 31

@jacobwod
Copy link
Member

Should've tagged this issue in this commit. Go check it out @eri-blan, @linusfj (I took care of the legacy Click.js implementation too).

@jacobwod jacobwod self-assigned this Jan 18, 2023
@jacobwod jacobwod added module:client/core Core functionality (not a plugin) new feature Request for adding/changing functionality labels Jan 18, 2023
@jacobwod jacobwod added this to the 3.x milestone Jan 18, 2023
@eri-blan
Copy link
Author

eri-blan commented Jan 18, 2023

Superb! Thanks for a quick fix. I will continue to investigate ArcGIS Server GetFeatureInfo behaviour and see if I can provide some more information.

I tested it with Länstyrelsen and Skogsstyrelsen WMS Services but will try other ones as well.

@jacobwod
Copy link
Member

jacobwod commented Jan 19, 2023

Glad to hear.

@eri-blan, regarding https://karta.orebro.se/mycartaserver/externkarta2.wms: I can't really test easily as the service provides geometries only outside our extent (and in another projection). If you control the service, can you put some test geometries around my area?

@eri-blan
Copy link
Author

@jacobwod, I added a test map for myCartaServer: https://karta.orebro.se/myCartaServer/testkarta.wms? I added some more supported coordinate systems, hope it works.

@eri-blan
Copy link
Author

eri-blan commented Mar 1, 2023

@jacobwod We tried 3.11 with an arcgis WMS service but couldn´t get application/vnd.esri.wms_raw_xml to show up in the info format list, any ideas? The service includes this info format in GetCapabilities.

@jacobwod
Copy link
Member

jacobwod commented Mar 1, 2023

Weird! Are you sure you've built upgraded Admin (cleaned your cache?). The format is among those supported:
Skärmavbild 2023-03-01 kl  13 21 47

What happens next is that Admin parses the response, looks in Capability.Request.GetFeatureInfo.Format and does this loop on our previously defined supportedFormats:
Skärmavbild 2023-03-01 kl  13 23 03

So if any of the iterated formats matches with the response from GetCapabilities, we add an <option> element to the <form>.

Would be really interesting to see which value formats has, in my second screenshot. (We really need some built-in debugging in Hajk, so we could set something like debug=verbose and see what's going on in these cases, @jesade-vbg , @Hallbergs! 💯 )

@eri-blan
Copy link
Author

@jacobwod Not sure if I´m doing something wrong but all i see is

const supportedInfoFormats = [ "application/json", "text/xml", "application/geojson", ];

I´ve tried the release build and building from master myself.

@jacobwod
Copy link
Member

Well, the mistake you're making is to use master. This issue is not merged, hence not closed. GitHub makes it easy though to see which branches contain a certain commit. Since I wrote (above) which commit contains the change, you can basically check it out here and make sure to use one of these more recent branches (preferably, develop).
Skärmavbild 2023-03-21 kl  14 26 01

@jacobwod jacobwod modified the milestones: 3.x, 3.12 Mar 21, 2023
@jacobwod jacobwod closed this as completed Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:client/core Core functionality (not a plugin) new feature Request for adding/changing functionality
Projects
None yet
Development

No branches or pull requests

2 participants