I'm using Postgis/Geoserver/Openlayers and I have a query that gets al the "towns" that are near a "road". Now, "road" and "towns" are different layers, and I want to show them in Openlayers.
But I have to do this with other layers too (schools, hotels, etc.) and I'm searching for some general solution. So for example in my web page I want to search for "Route 66" and then load the towns that it crosses, but then I want to see the hotels near that route without the town and so on.
I know a can define a view for each layer that interacts with "roads" (view_road_schools, view_road, towns, etc) then, in Openlayers I'd use a CQL_Filter over each view and get the specific. Is this the correct way to do it? I'm kind of new with this.
Thanks, and I'm sorry about the length.

