0

The below files are generated from QGIS2Web tool and altered by me, I generated the OpenLayers code using QGIS2Web. The problem is not showing the pop-up(attribute information) for multiple Layer files. For a single file pop-up function is working fine (I attached the screenshot with pop-up).

I would like to show my attribute details on the right side of the panel(permanent) when the user clicked the particular polygon.

How to customize based on my need?

single layer with pop-up of attribute information

The above pic shows the pop-up function (working fine for single layer).

Multiple layer file didn't show the attribute information

The above pic shows the multiple layer structure. I want to show attribute information for the topmost visible layer.

  • It may depend on how you are implementing the layers in OpenLayers. For both raster and vector layers you could use map.forEachLayerAtPixel() to identify the non-transparent layers where the user clicked, then select the topmost in the layer stack. For vectors you could also use map.forEachFeatureAtPixel(pixel, function(feature, layer){ ... }); where the callback is passed the feature and its layer. – Mike Jun 11 at 16:08
  • 1
    I used QGIS2Web tool for generating the layers in OpenLayers, so I don't know where to change my code. I'm a beginner for OpenLayers. so can you please give me some more idea. – Gobinath Jun 11 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.