1

i have generate a web map by using qgis2web plugin. The map contain 2 wms layers from my geoserver and one OSM basemap. the popup working nicely when click on the feature. but there is empty popup when click on any other area. Is there any where in the .js to mode so that no empty when click on area other than the wms layer feature.

2
  • How js framework do you use? openlayers, leaflet...? Aug 1 '19 at 5:57
  • @gianfrancodipietro export as openlayer. Aug 1 '19 at 6:25
2

This is not currently possible with the code generated by qgis2web. The code merely opens an iframe whose source is the getFeatureInfo URL. In other words, the client has no knowledge of whether a feature is present or not.

A solution could be developed to fetch the getFeatureInfo URL and analyse it, only then displaying the content if an appropriate response is received. However, I don't know whether getFeatureInfo responses comply with any standard. If they do, it could be done. If not, it would be extremely difficult, trying to detect possible "no feature" responses from various WMS servers.

1
  • Ideally make a request with info_format=application/json to analyse the output, but if the server doesn't support that you could check that the output contains the required number of html table elements gis.stackexchange.com/questions/309917/…
    – Mike
    Aug 3 '19 at 11:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.