[GIS] How to join a WFS layer to a stand-alone table in OpenLayers

attribute-joinsattribute-tablegeoserveropenlayers-2

I'm a complete novice at OpenLayers, and am checking whether the following is possible.

I envisage a dataset of polygons in GeoServer, being served as a WFS layer into OpenLayers. The polygons won't have any attributes other than a unique identifier (eg State name).

The attributes for the polygons will be provided by a stand-alone table, which should match to the polygons via the unique identifier.

The join needs to be configured within the user's browser (rather than on the server) since the table will be unique to that user and that session – the table is generated dynamically as the result of the user's actions.

So my questions are:

  • is it possible to join a WFS layer to a stand-alone table?
  • is there any sample code showing how to set this up?

Thanks

Best Answer

I'm not sure i quite follow but maybe this will help. Perhaps you can pre-join the tables ahead of time using a SQL Query. Then provide a WFS filter in your OpenLayers WFS request to say something like give me all items in my table WHERE state = 'FL'.

Another possibility is to use GeoServer's rest api to programmatically create or configure the layer from your OpenLayers application.

If you feel I did not understand your question could you please provide a simple UseCase. example: User selects ... expects ... etc.