Geoportail-Luxembourg / geoportailv3

geoportailv3 is the implementation of the v3 of the map viewer of the luxembourgish geoportal
MIT License
26 stars 16 forks source link

showLayerInfoPopup shows empty popup when clicking beside feature #3063

Closed PitWenkin closed 1 year ago

PitWenkin commented 1 year ago

When using showLayerInfoPopup: true clicking anywhere on the map where no feature exists results in an empty popup e.g. https://apiv4.geoportail.lu/proj/1.0/build/apidoc/examples/#example14 Screenshot

PitWenkin commented 1 year ago

This only happens when adding at least one layer. When using MyMaps with custom click event, an empty popup is opened in addition to the popup generated by the custom click event.

rmichaelis commented 1 year ago

This is solved in apiv4

PitWenkin commented 1 year ago

Seems not to be fixed when having multiple layer enabled. Or depends ot the selected layers.

I have added the following layers to my map and they are enabled:

When clicking anywhere on the map the request

https://map.geoportail.lu/getfeatureinfo?&layers=147,682,685,808,1381,1713&box1=80527.82086990963,68763.1183303995,80776.20400911463,69010.864262241&box2=80645.8056779875,68880.79763218922,80658.22483494718,68893.18492878313&BBOX=678311.1618604744,6363356.649352871,689805.3799888578,6371000.352181388&WIDTH=1203&HEIGHT=800&X=975.875&Y=156.37890625&tooltip=1&lang=fr&srs=EPSG:3857&zoom=14

is triggered and returns

[{"remote_template": false, "template": "bus.html", "layer": "147", "ordered": false, "features": [], "has_profile": false, "total_features_count": 0, "features_count": 0, "tooltip": ""}, {"remote_template": false, "template": "default.html", "layer": "682", "ordered": false, "features": [], "has_profile": false, "total_features_count": 0, "features_count": 0, "tooltip": "\n"}, {"remote_template": false, "template": "default.html", "layer": "685", "ordered": false, "features": [], "has_profile": false, "total_features_count": 0, "features_count": 0, "tooltip": "\n"}, {"remote_template": false, "template": "default.html", "layer": "808", "ordered": false, "features": [], "has_profile": true, "total_features_count": 0, "features_count": 0, "tooltip": "\n"}, {"remote_template": false, "template": "default_table.html", "layer": "1381", "ordered": false, "features": [], "has_profile": false, "total_features_count": 0, "features_count": 0, "tooltip": "\n"}, {"remote_template": false, "template": "default.html", "layer": "1713", "ordered": false, "features": [], "has_profile": false, "total_features_count": 0, "features_count": 0, "tooltip": "\n"}]

All Layers except the Bus layer return \n in their tooltip which results in a popup with 4 hr's. Screenshot 2023-08-07 at 21 33 01 https://github.com/Geoportail-Luxembourg/geoportailv3/blob/45722f46bd5e4650ed3b01b1920de3732f848186/geoportal/jsapi/src/map.js#L2639

Maybe the return should not be simply \n or \n should also be considered as an empty return. https://github.com/Geoportail-Luxembourg/geoportailv3/blob/45722f46bd5e4650ed3b01b1920de3732f848186/geoportal/jsapi/src/map.js#L2713

rmichaelis commented 1 year ago

yes you are right. The webservice returned a wrong answer. it should be ok now.

PitWenkin commented 1 year ago

Seems to be fixed at a first glance. I will check in detail next week.