[Geoserver-users] GetLegend in geoserver

Hello,

I configure SLD file for my shp file (with roads), where have fiew <rules> wich define diferent size of line. Size of this line is force different <MinScaleDenominator> and <Filter>. All works great.

What is the problem, geoserver generate legend in strange form (orginal.png) but i want have something like that (like.png - created by gimp). Where I make mistake!?

--
Best regards,

like.png

orginal.png

Hi Daniel,

I see the issue... so it appears that the legend producer is simply producing an entry for every single rule in the sld. What you need is to group rules by there scale. Interesting.

I would have too look into this to see if its possible... should be. I think it makes sense to perhaps make this a "format option" you can turn on and off.

Daniel, do you want to create a jira task for this?

What do other developers think?

Daniel Dubiel wrote:

Hello,

I configure SLD file for my shp file (with roads), where have fiew <rules> wich define diferent size of line. Size of this line is force different <MinScaleDenominator> and <Filter>. All works great.

What is the problem, geoserver generate legend in strange form (orginal.png) but i want have something like that (like.png - created by gimp). Where I make mistake!?

------------------------------------------------------------------------

------------------------------------------------------------------------

------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

!DSPAM:4007,48072e65107301431913854!

------------------------------------------------------------------------

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4007,48072e65107301431913854!

--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com

Justin Deoliveira ha scritto:

Hi Daniel,

I see the issue... so it appears that the legend producer is simply producing an entry for every single rule in the sld. What you need is to group rules by there scale. Interesting.

I would have too look into this to see if its possible... should be. I think it makes sense to perhaps make this a "format option" you can turn on and off.

Daniel, do you want to create a jira task for this?

What do other developers think?

Having a way to generate a per scale legend seems like a good idea.
Yet from the sample he attached it seems it's more than just that,
we would need to create the composite symbols that the map is generating due to the usage of multiple feature type styles... Figuring out the possible combinations out of the rule conditions would seem pretty hard.
Not sure we can actually automate that (suggestions? :slight_smile: )

Cheers
Andrea

Hello

The problme was with 2 cases one ofcource 'generate legend per scale' - still have problem with it :stuck_out_tongue: and second I created:

<FeatureTypeStyle>
<Rule>
<Filter ...
<MinScaleDenominator>
<LineSymbolizer> <!-- only one for this rule -->
...

for background of my way and in other <rule> this same with other color and width for foreground (not second LineSymbolizer). Then roads look great but problem is with legend :P.
When I recreated my sld legend looks much better but roads have some small defects - but i can live with it.

Andrea Aime pisze:

Justin Deoliveira ha scritto:

Hi Daniel,

I see the issue... so it appears that the legend producer is simply producing an entry for every single rule in the sld. What you need is to group rules by there scale. Interesting.

I would have too look into this to see if its possible... should be. I think it makes sense to perhaps make this a "format option" you can turn on and off.

Daniel, do you want to create a jira task for this?

What do other developers think?

Having a way to generate a per scale legend seems like a good idea.
Yet from the sample he attached it seems it's more than just that,
we would need to create the composite symbols that the map is generating due to the usage of multiple feature type styles... Figuring out the possible combinations out of the rule conditions would seem pretty hard.
Not sure we can actually automate that (suggestions? :slight_smile: )

Cheers
Andrea

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Best regards,

On Friday 18 April 2008 02:56:24 pm Andrea Aime wrote:

Justin Deoliveira ha scritto:
> Hi Daniel,
>
> I see the issue... so it appears that the legend producer is simply
> producing an entry for every single rule in the sld. What you need is to
> group rules by there scale. Interesting.
>
> I would have too look into this to see if its possible... should be. I
> think it makes sense to perhaps make this a "format option" you can turn
> on and off.
>
> Daniel, do you want to create a jira task for this?
>
> What do other developers think?

Having a way to generate a per scale legend seems like a good idea.
Yet from the sample he attached it seems it's more than just that,
we would need to create the composite symbols that the map is generating
due to the usage of multiple feature type styles... Figuring out the
possible combinations out of the rule conditions would seem pretty hard.
Not sure we can actually automate that (suggestions? :slight_smile: )

Hi, chimming in...

Daniel, what request are you using to get that result?

It seems to me the behaviour you're looking for is just the default one (and
the one from the sld spec).

What GeoServer does is the following:
- If the GetLegendGraphic request includes a RULE=<ruleName> parameter, a
graphic for that specific rule is generated
- otherwise, it tries to figure out which rules apply to the request scale,
and produces a legend graphic for each rule that applies.

The concrete code is like this:
        final Rule applicableRules;

        final double scaleDenominator = request.getScale();

        if (request.getRule() != null) {
            applicableRules = new Rule { request.getRule() };
        } else {
            applicableRules = getApplicableRules(ftStyles, scaleDenominator);
        }

So I see where the problem might be. It seems if you pass the SCALE argument
you'll get what your're looking for. Still, it seems wrong to me that if
SCALE is not being passed we generate a legend for all rules, instead of
calculating the scale denominator from the map size and request extent...
I would need to check the spec to see whether that should be the standard
behaviour or not.

Could you please open a jira issue and assign it to me so I don't forget and
you get notified of any progress?

Cheers,

Gabriel

Cheers
Andrea

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/java
one _______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4045,48089a8f116967180515871!