Hi, i am trying to get my head around creating legends for SLD's and have a
couple of questions:
1) what does 'for ceRule' mean, when in the context of 'LEGEND_OPTIONS=for
ceRule:True'
2) How exactly do i implement the legend request? For example, do i insert
the request within the SLD or do i paste the request within the URL address
bar after the SLD request?
Apologies if these questions, particularly the last one, sound a little
silly but i have read all the GetLegendGraphic information within the user
manual, as well as forum postings and the relevant OGC booklet sections, but
am still none the wiser.
You may want to read the standard for a description of how GetLegendGraphic operation works?
–
Jody Garnett
On Tuesday, 18 June 2013 at 8:55 PM, cjones wrote:
Hi, i am trying to get my head around creating legends for SLD’s and have a
couple of questions:
what does ‘for ceRule’ mean, when in the context of ‘LEGEND_OPTIONS=for
ceRule:True’
How exactly do i implement the legend request? For example, do i insert
the request within the SLD or do i paste the request within the URL address
bar after the SLD request?
When making the request you describe the style (for each layer) using the same techniques as for GetMap:
named style - for a style published for your layer, or
URL pointing to the SLD file, or
encoding the SLD document right then and there).
Apologies if these questions, particularly the last one, sound a little
silly but i have read all the GetLegendGraphic information within the user
manual, as well as forum postings and the relevant OGC booklet sections, but
am still none the wiser.
Perhaps Hhve a look at the example on the demo request page in GeoServer.
I have read the standard for the GetLegendGraphic, as well as the GetMap,
but once again, these are not very insightful. I have also used the 'Demos'
on GeoServer to try and get an idea of how to apply the legend request to a
specific SLD but once again, this is of little help.
Below is a sample request for a very simple legend; i have made this request
whilst keeping all the information i have read in mind, but still it does
not seem to work (with the request being aimed at the URL with my SLD file,
which is named as 'cj_point') - might you know where i am going wrong?
I have read the standard for the GetLegendGraphic, as well as the GetMap,
but once again, these are not very insightful. I have also used the ‘Demos’
on GeoServer to try and get an idea of how to apply the legend request to a
specific SLD but once again, this is of little help.
Below is a sample request for a very simple legend; i have made this request
whilst keeping all the information i have read in mind, but still it does
not seem to work (with the request being aimed at the URL with my SLD file,
which is named as ‘cj_point’) - might you know where i am going wrong?
forceRule (boolean) by defaul rules for a ColorMapEntry are not drawn to keep the legend small and compact, unless there are not labels at all. You can change this behaviour by setting this parameter to true.
Your second point -
I believe a getLegendRequest is a separate entity and should be sent as a URL. So:
I have read the standard for the GetLegendGraphic, as well as the GetMap,
but once again, these are not very insightful. I have also used the ‘Demos’
on GeoServer to try and get an idea of how to apply the legend request to a
specific SLD but once again, this is of little help.
Below is a sample request for a very simple legend; i have made this request
whilst keeping all the information i have read in mind, but still it does
not seem to work (with the request being aimed at the URL with my SLD file,
which is named as ‘cj_point’) - might you know where i am going wrong?
This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.
Jonathan, you were correct - i embed the request as a URL. Once i had
enabled a given SLD to be viewed with an associated layer, I ended up
finding a basic GetLeged request for my layer and style within my WMS
GeoServer capabilities.
However, a new problem arises from this - several of my SLD's have quite a
few rules within them regarding which symbols should be applied to which
values (this is particularly the case regarding my wind barb SLD which has
over 60 rules). I want my legend to show each of the symbols with the value
it represents alongside it, however when applying the GetLegend request i
get the following warning:
java.lang.IllegalArgumentException: Unable to create a legend for this
style, we need exactly 1 rule
Unable to create a legend for this style, we need exactly 1
rule</ServiceException>
Are either of you aware of anyway i can apply a legend to an SLD composed of
multiple rules?
On Fri, Jun 21, 2013 at 3:27 PM, cjones <c.jones@anonymised.com> wrote:
java.lang.IllegalArgumentException: Unable to create a legend for this
style, we need exactly 1 rule
Unable to create a legend for this style, we need exactly 1
rule</ServiceException>
Are either of you aware of anyway i can apply a legend to an SLD composed
of
multiple rules?
This definitely works, as one of the GetLegend sample requests we ship with
the
default data directory is for states, that has two feature type styles and
4 rules.
I've searched for that error message in the current GeoServer code base,
but cannot
find it.
Unless... do you have a vector style (point, line or polygon symbolizer)
applied to a raster layer?
Yep - my original dataset is a raster but i am using the
'RasterAsPointCollection' transformation prior to implementing the SLD rules
in which the symbols are applied through the use of a 'PointSymbolizer'.
On Fri, Jun 21, 2013 at 3:56 PM, cjones <c.jones@anonymised.com> wrote:
Hi Andrea,
Yep - my original dataset is a raster but i am using the
'RasterAsPointCollection' transformation prior to implementing the SLD
rules
in which the symbols are applied through the use of a 'PointSymbolizer'.
I see. Rendering transformations are relatively new, and GetLegendGraphics
is not the most
used call, so this combination is probably tried for the first time now,
and as you've seen, it
does not work.
Can you open a bug report on jira.codehaus.org about it? If you don't have
an account
you can create one at xircles.codehaus.org
I've created a bug report on codehaus, entitled 'Issue GEOS-5860 - GetLegend
request doesn't work with Rendering Transformations'. Fingers crossed
something can be done about it!
On Fri, Jun 21, 2013 at 5:02 PM, cjones <c.jones@anonymised.com> wrote:
I've created a bug report on codehaus, entitled 'Issue GEOS-5860 -
GetLegend
request doesn't work with Rendering Transformations'. Fingers crossed
something can be done about it!
Yes, it is fixable, the issue is as usual directing resources towards it
instead of towards
something else.
If you can code I can tell you what classes would be involved in the
changes, "do it yourself"
is a great way to make changes land in GeoServer soon (the other way being
looking into
commercial support)
I can do minor coding, however a colleague of mine (who is heavily into his
coding) may be able to help if and when i stumble if i ask nicely! So yes,
if you could let me know what classes would be involved in the changes, i
will give it a try I can't promise how successful it will be though!
On Fri, Jun 21, 2013 at 5:26 PM, cjones <c.jones@anonymised.com> wrote:
I can do minor coding, however a colleague of mine (who is heavily into his
coding) may be able to help if and when i stumble if i ask nicely! So yes,
if you could let me know what classes would be involved in the changes, i
will give it a try I can't promise how successful it will be though!
Ok, the class is BufferedImageLegendGraphicBuilder in the wms module of
GeoServer,
there is some logic to check if we need to generate a raster legend in
the buildLegendGraphic
method.
However... I see it's already checking for rendering transformations and
their output so either:
* there are bugs in that logic
* you have an old version of GeoServer, older than 2.3.0? 2.3.0 should be
the first version
that takes into account rendering transformations in the legend graphics
code
(but if you have to upgrade, it'd recommend to wait a few days and pick
2.3.3)