2

I used Qgis2Web and I'm really a beginner. Is there a way can I highlight a feature using their coordinates? I'm currently developing a website which suggests location based from pre-defined inputs. And the only thing i have is the lat and lon. I hope these helps :)

2
  • 2
    Can you explain in a little more detail? Do you mean have users type in long/lat into a field, and features at that location on the map are highlighted? Or do you mean you want to specify the long/lat in your map code? Oct 5, 2017 at 10:24
  • I'm currently developing a website which suggests a location based from the pre-defined inputs. And the only thing i have is the lat and lon. I hope these helps :)
    – Rheena
    Oct 5, 2017 at 12:15

1 Answer 1

1

qgis2web exports all layers as geoJson so you have all your features available. You could use map.forEachFeatureAtPixel method passing your coordinates as the pixel parameter. The hard part so is to modify the javascript files exportet by qgis2web.

So actually I would recommand to use QGIS server and load the layers as WMS or WFS layers:

  1. On WMS layers you can access and highlight the features with getGetFeatureInfoUrl passing your coordinates as a parameter. This example may give you some hints.

  2. On WFS layers you can access and highlight the features with forEachFeatureAtPixel passing your coordinates as the pixel parameter. This example may give you some hints.

Your Answer

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

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