[Geoserver-users] SLD_BODY param

You will most likely have to have both the base style and the
highlighted style specified in the same sld document. Which should be
doable with multiple rules.

So, if I have understood well, first I make my default style, and in the
same rule, I need to add a new empty rule (by default at first), which
will be used to highlight features. But then, how can this highlight
rule be changed through parameters (SLD_BODY, STYLES or SLD)?

Another way could be to make two requests. One with the default style,
and one with the style for the highlighted features.

But this way I will be adding a lot of complexity in my client side, I
will need one highlight layer for every one.

Thank you for your help.

Unfortunately both methods will add complexity to your client. Things
would be a little easier for you if the GeoServer PutStyles/GetStyles
operations were implemented, but they aren't at this time unfortunately.

How are you interacting with the server on the client side?

So, if I have understood well, first I make my default style, and in the
same rule, I need to add a new empty rule (by default at first), which
will be used to highlight features. But then, how can this highlight
rule be changed through parameters (SLD_BODY, STYLES or SLD)?

Yup, you can start with the normal "default" style. And then in the
FeatureTypeStyle that is being used, you can add a second rule which
contains a filter that is engaged only for the highlighted features:
<FeatureTypeStyle>
  ...
  <Rule>
    ... contains symbolizers for default style
  </Rule>
  <Rule>
    <ogc:Filter>
      <ogc:FeatureId fid="<the feature you want to highlight>"/>
    </ogc:Filter>
    ... symbolizer(s) for highlighted feature

  </Rule>
  ...
</FeatureTypeStyle>

So to make it work you would have to build up this sld document for
every request, or keep a "prototype" of some sort around and for each
request with a highlighted feature set the filter accordingly, and then
serialize the document into the SLD_BODY param.

Another way could be to make two requests. One with the default style,
and one with the style for the highlighted features.

But this way I will be adding a lot of complexity in my client side, I
will need one highlight layer for every one.

Yeah... although you would not have to worry about keeping the default
style around on the client, that can be strictly managed by the server
and you can just reference it by name. That way you just have to worry
about the highlighted style.

Unfortunately neither alternative is particularly nice is it :). However
I could be missing another way to engage two styles simultaneously in
GeoServer, but nothing comes to mind...

Thank you for your help.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:1004,45e44bcb275191804284693!

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

Aitor Calero Garcia wrote:

You will most likely have to have both the base style and the
highlighted style specified in the same sld document. Which should be
doable with multiple rules.

So, if I have understood well, first I make my default style, and in the
same rule, I need to add a new empty rule (by default at first), which
will be used to highlight features. But then, how can this highlight
rule be changed through parameters (SLD_BODY, STYLES or SLD)?

One more thing. I should have phrased this better. By two requests, i
should have said one request asking for the layer two times, like with:

...LAYERS=myLayer,myLayer&STYLES=default,highlighted...

Thank you for your help.

!DSPAM:1004,45e44bc8275081702038478!

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

Justin Deoliveira wrote:

One more thing. I should have phrased this better. By two requests, i
should have said one request asking for the layer two times, like with:

...LAYERS=myLayer,myLayer&STYLES=default,highlighted...

Yet another bit, Andrea just reminded me of the ability to filter in a
wms request. Which means that for the highlighted layer you can request
just the feature you want, instead of the entire layer again. This will
help with performance, and probably make your style simpler.

This is a much better solution for you since you wont have to worry
about filtering in the sld!! So the request looks like:

..."LAYERS=myLayer,myLayer&styles=default,highlighted&FILTER=(),<Filter><FeatureId
fid="highlightedFeature"></Filter>"...

The only thing that changes between request is the feature id you want
to highlight. And you don't have to worry about creating the sld on the
fly.

Does that make sense?

-Justin

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org