1

I've built a web application using OpenLayers, which is connected to my PostGIS database through Geoserver. Now that I'm able to successfully display all of the layers, I'd like to add querying/interactivity capabilities to the map. For instance, I'd like to create a dropdown menu of checkboxes so the user could "Choose X who have done Y", another dropdown to "Choose X who haven't done Y", etc. I'm having trouble figuring out how exactly to add in this functionality. Does anybody know any good resources/examples for how I might go about doing this?

Thanks for your help.

2

Rather than using your client-side code to query your database (big security risk), I would suggest you use Geoserver's WFS filtering capabilities. Geoserver's WFS implementation supports a number of filtering techniques, including cross-layer filtering through the querylayer extension.

Here is an example implementation. The js in the source is not minified so it is readable.

  • Great - thank you very much! The filters might be exactly what I'm looking for. I'll give it a try. – Haynes Aug 8 '14 at 18:35
  • 1
    For those queries that are too complicated (using joins, or obscure database functions) to be expressed in WFS, you can use the "SQL Views" feature of GeoServer to access any SQL query. – Paul Ramsey Apr 9 '15 at 16:55

Your Answer

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

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