[OpenLayers-Dev] Styles Framework question

Tim Schaub tschaub at opengeo.org
Thu Jan 22 16:06:13 EST 2009


Andreas Hocevar wrote:
> Hi Eric,
> Eric Lemoine wrote:
>> I have a general question regarding the Styles Framework. We have
>> classes such as OpenLayers.Style, OpenLayers.Filter, OpenLayers.Rule,
>> etc. Tell me if I'm wrong but these classes have been built with SLD
>> in mind, so they follow the SLD spec. Can we image extending these
>> classes and going beyond SLD? Or do we want to strictly stick to SLD?
> OpenLayers.Style was designed with the goal represent an SLD UserStyle
> as good as possible, same for OpenLayers.Rule. The latter has currently
> the shortcoming of allowing only one symbolizer of each type, because of
> the symbolizer hash it uses. For OpenLayers 3.0, we should change this
> to a symbolizers array. And finally, we have nothing yet to represent a
> FeatureTypeStyle.
> OpenLayers.Filter can also be used outside the styles framework, and
> represents OGC filters.
> Now to answer your question: Yes, the design goal was to support SLD.
> But I don't see a reason why all those classes should not be extended to
> support features beyond SLD and OGC filters (although I cannot think of
> any right now).

Things we currently support that are not directly serialized in SLD:

1) Support for style.context functions.  If we had better support for 
OGC expressions, there would not be as big a need for this - but they 
are handy.

2) Support for graphicXOffset, graphicYOffset, and graphicZIndex in our 
symbolizers.  No immediate analog in SLD.

3) Support for backgroundGraphic in our symbolizers (and 
backgroundXOffset, backgroundYOffset, backgroundGraphicZIndex).  This 
would be better handled with support for multiple symbolizers (of the 
same type).

4) Support for multiple rendering intents (in a StyleMap).  This is 
pretty much handled by different user styles in an SLD - so maybe not 
that different.

So, I agree that we don't need to strictly stick with the SLD spec. 
However, there is a lot of value in being able to persist styles.  And, 
since there is some good expressiveness in SLD that we don't support, I 
think there is plenty of room for improvement on our part that is still 
in line with the spec.

I also am reminded pretty regularly how hard it is to hand code good 
style stuff in OpenLayers.  I look forward to making things more 
convenient.  It will also be good when we can drop the legacy code and 
write things a little more cleanly.


> Regards,
> Andreas.

Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.

More information about the Dev mailing list