I have a layer in Geoserver composed of many linestrings which I issue a WFS request for using OpenLayers and GeoExt. The linestrings display fine and I am able to add the layer to a layer-tree (with all records controlled by one checkbox). What I would like to do is group the linestrings based on an attribute and have those groups separated in the layer tree.
Right now, the WFS layer contains records with geometry and season_name attributes. I would like to group the records by season_name. The resulting layer tree would have as many layers/nodes as there are unique season_names. Note that the nature of the data requested from Geoserver is dynamic, and thus new season_names will become available over time - I would thus prefer not to hard-code each season_name.
The layer tree now:
- Linestrings (containing all records)
How I would like it to be:
- season_name1 (containing records with season_name == season_name1)
- season_name2 (containing records with season_name == seaosn_name2)
Any suggestions on how this may be done would be appreciated. Is there functionality built into GeoExt / OpenLayers to handle this, or will some custom solution need to be implemented? If a custom implementation is necessary, how could one create new layers without knowing in advance how many there will be, or what they will be called?