Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


share|improve this question
Unless the attrs are used for labeling/styling purposes there is no need to join the two datasets in OpenLayers. If you only want to display the attrs on feature selection, just use the GetFeatureInfo control and do the join there (it's actually just a hash lookup by key). – unicoletti Jan 30 '12 at 13:54
@unicoletti thanks for the info, which I'm sure will come in handy at some stage. In this particular case I do need the attributes for styling purposes. – Stephen Lead Jan 30 '12 at 20:41

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.

share|improve this answer

I am not sure if Openlayers has a kind of built in capability for doing that but I would use a strategy like getting the WFS data in JSON (or GeoJSON) format from the server and would merge it with my client side data (which probably can be provided in json format as well). Of course I am not sure about performance issues there but on client I don't think there can be a much faster solution (since we are not on a database system in any case).

share|improve this answer
thanks oalan. I'm a bit worried about the performance too since my dataset covers a large area with potentially complex polygons. I'll post back if I come up with an answer – Stephen Lead Jan 30 '12 at 9:00
Stephen the discussion here may help you if you are interested in Json solution... – Ozgun Alan Jan 30 '12 at 10:35

When you say unique for each user and session how much do the tables vary? If in most cases they have the same schema, maybe you can have a static table which is populated in real time based on user actions. And this table could be used together with Geoserver's SQL Views to create the layer. So CQL_FILTER's could be used to show changes in the layer when data in the DB changes. Just a thought.

share|improve this answer
Thanks for the tips. My requirements for this have ceased, but it'd be an interesting problem to solve one day out of interest... – Stephen Lead Nov 30 '12 at 2:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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