1

I am wondering how, and if it is possible, to filter a geoserver's layer (from a large shapefile) on a specific geometry coming from a postgis table.

I have a huge shapefile for a country. I'd like the user to only be able to view a limited area of the layer he has been granted permission for (a city or whatever). The geometry he is allowed to see is stored as a multipolygon in a postgis table.

Is there a way to do that directly in geoserver (server-side)?

If not, could you give me some hints / technologies to use?

4
  • filtering is possible both with wfs and wms filtering. wfs should be more straight forward Commented May 31, 2016 at 15:08
  • @elasticrash this is done on the client side ? I would prefer a solution on the geoserver server
    – poussma
    Commented May 31, 2016 at 15:25
  • you could filter a layer directly through SLD but you need something like an Id or an attribute and that can't come from anywhere else really than either being hard-coded or from the client. What are you trying to achieve. cause geoserver layers cannot "talk" to other tables. except if you create a geoserver extension github.com/geoserver/geoserver/tree/master/src/extension Commented May 31, 2016 at 15:44
  • Look for the cross layer filter plugin
    – Ian Turton
    Commented May 31, 2016 at 16:48

1 Answer 1

1

As you want to use Postgis, what about this (tested) workaround:

  1. migrate your large SHP to your Postgis;
  2. Create a Geoserver SQL View Layer with the SQL filter logic, using, for example, ST_Intersects;
  3. This layer also use "SQL view parameters" to pass the ID (or name, or whatever field you want) so you can pass the value with "viewparams" parameter.

Check this page from Geoserver doc.

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.