4

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

2
  • 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
    Commented Jan 30, 2012 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. Commented Jan 30, 2012 at 20:41

3 Answers 3

1

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.

0

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).

2
  • 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 Commented Jan 30, 2012 at 9:00
  • Stephen the discussion here may help you if you are interested in Json solution...
    – Ozgun Alan
    Commented Jan 30, 2012 at 10:35
0

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.

1
  • Thanks for the tips. My requirements for this have ceased, but it'd be an interesting problem to solve one day out of interest... Commented Nov 30, 2012 at 2:39

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.