Dynamic Legend

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamic Legend

Antonio Parrotta
Hi all


I have a postgres layer perfectly styled with the colors fetched from a property "graphic". The layer is dislayed correctly on map.

What I would like to have is the legend as well. This legend should reflect colors and labels from the styled layer.

I saw that currently geoserver builds the legend from rules in the sld, but problem is that I have only a single rule. Colors are fetched from a property field using ogc.

is there a way to have such legend that retrieve colors and labels from properties instead of rules

Thanks a lot

- Antonio

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Geoserver-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic Legend

geowolf
On Wed, Mar 11, 2015 at 6:17 PM, Antonio Parrotta <[hidden email]> wrote:
Hi all


I have a postgres layer perfectly styled with the colors fetched from a property "graphic". The layer is dislayed correctly on map.

What I would like to have is the legend as well. This legend should reflect colors and labels from the styled layer.

I saw that currently geoserver builds the legend from rules in the sld, but problem is that I have only a single rule. Colors are fetched from a property field using ogc.

is there a way to have such legend that retrieve colors and labels from properties instead of rules


Not at the moment, to do that we would need to figure out all possible values and all possible values
combinations (in case of multiple properties used in the SLD) which in the worst case would require
a visit of the entire source data set (which again, in general, is not feasible because that data set
might be huge).

I believe we have a pull request incoming that will make it possible to give GeoSErver a pre-built
legend to be used in GetLegendGraphics, which should fit well your case.

Or... well I guess we could implement some way to do the actual data full scan (with distinct value
extraction when there is a single attribute involved), but we'd need to find a way to make sure
it does not turn into a performance killer... like caching, or making it something only the admin
can run and save the results as a pre-cooked legend, or save somewhere the data distribution
summary and have the legend be built on the fly from that summary, avoiding to read the whole
dataset (issue, this summary can get out of synch with the data).
Would be interesting work, if we can find funding to sponsor it.

Cheers
Andrea
 
--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.
==

Ing. Andrea Aime 
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549


AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

 

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility  for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.


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

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Geoserver-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic Legend

Katie
Hi all,

I would like to know if someone has solved the Dynamic Legend issue that
Geowolf raised?

I now have the same problem. I have a postgres table that I styled with a
sld using the color attribute from the color column. My map displays the
colors perfectly but does not show anything in the legend part from a black
polygon.

Is there a way that I can edit the sld file to load attributes from a column
in the same postgres table.

Any help appreciated.



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html


_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic Legend

Olyster
As stated by Andrea, it would require to scan all possible values from the
source table.

I don't know if the distinct values from your table are changing regularly
but what we did is to create an image by hand representing all values (color
and corresponding label) and use Add Legend function in the style page.



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html


_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic Legend

jody.garnett
In reply to this post by Katie
I think for a few specific cases, such as an SLD Recode function or Interpolate function we could look at the style definition and come up with an legend. If you just have the colors directly listed in your table we could not determine them statically from just the SLD file. 

aside: if a developer did want to recognize recode / interpolate functions during legend graphic generation I would I recommend constraining it so polygon symbolizer would just be based on the expression used for fill for example. Rather than do the power set of variations of fill and stroke. This would be a feature request, happy to talk a volunteer through the design, or recommend on of our service providers.

One thing I would recommend both of you doing is using the Geoserver style editor to provide an online resource (ie ready made icon) for the style. At the very least this would avoid you having a black polygon.

You may also be able to use the Symbology Encoding 1.1 fallback value (which is used if a function is not available) to avoid having the default "black" used.
--
Jody Garnett


On Fri, 3 May 2019 at 07:20, Katie <[hidden email]> wrote:
Hi all,

I would like to know if someone has solved the Dynamic Legend issue that
Geowolf raised?

I now have the same problem. I have a postgres table that I styled with a
sld using the color attribute from the color column. My map displays the
colors perfectly but does not show anything in the legend part from a black
polygon.

Is there a way that I can edit the sld file to load attributes from a column
in the same postgres table.

Any help appreciated.



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html


_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users


_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic Legend

Katie Sassenberg-2

Thanks for the reply Jody,

 

Maybe I should also give an explanation of why I need a dynamic legend. 

 

I’m working on a project where contractors are used for certain jobs.  On the map we need to see which contractor worked where. This is the easy part. My problem comes in when the client adds a new contractor to the database. In the form  for adding a new contractor we also have an option of choosing a colour.   This works great.  My issue is to have a legend that also updates dynamically.  A ready made legend would then have to be updated manually each time a new contractor is added, and we as the developers of the system don’t always know when this happens. 

 

Example of information in my table:

cid:image001.png@01D504BE.57E6F9B0

 

I would like to see in my legend the organization name as a polygon with the colours indicated in the table.

cid:image002.png@01D504BE.6DF8FFF0

cid:image003.png@01D504BE.B9BC2430

 

My sld file:

 

<?xml version="1.0" encoding="UTF-8"?><sld:StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:sld="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" version="1.0.0">

  <sld:NamedLayer>

    <UserStyle>

      <sld:FeatureTypeStyle>

               <sld:Name>organization</sld:Name>      

        <sld:Rule>

               <sld:Title>

                                <ogc:PropertyName>organization</ogc:PropertyName>

                </sld:Title>                        

                <sld:PolygonSymbolizer>

                                <sld:Stroke>

                                                <CssParameter name="stroke">

                                                                <ogc:PropertyName>colour</ogc:PropertyName>

                                                </CssParameter>                            

                                                                <CssParameter name="stroke-width">3.5</CssParameter>

                                </sld:Stroke>

                </sld:PolygonSymbolizer>

        </sld:Rule>

      </sld:FeatureTypeStyle>

    </UserStyle>

  </sld:NamedLayer>

</sld:StyledLayerDescriptor>

 

Katie Sassenberg

 

From: Jody Garnett <[hidden email]>
Sent: Friday, 03 May 2019 20:32
To: Katie <[hidden email]>
Cc: GeoServer Users <[hidden email]>
Subject: Re: [Geoserver-users] Dynamic Legend

 

I think for a few specific cases, such as an SLD Recode function or Interpolate function we could look at the style definition and come up with an legend. If you just have the colors directly listed in your table we could not determine them statically from just the SLD file. 

 

aside: if a developer did want to recognize recode / interpolate functions during legend graphic generation I would I recommend constraining it so polygon symbolizer would just be based on the expression used for fill for example. Rather than do the power set of variations of fill and stroke. This would be a feature request, happy to talk a volunteer through the design, or recommend on of our service providers.

 

One thing I would recommend both of you doing is using the Geoserver style editor to provide an online resource (ie ready made icon) for the style. At the very least this would avoid you having a black polygon.

 

You may also be able to use the Symbology Encoding 1.1 fallback value (which is used if a function is not available) to avoid having the default "black" used.

--

Jody Garnett

 

 

On Fri, 3 May 2019 at 07:20, Katie <[hidden email]> wrote:

Hi all,

I would like to know if someone has solved the Dynamic Legend issue that
Geowolf raised?

I now have the same problem. I have a postgres table that I styled with a
sld using the color attribute from the color column. My map displays the
colors perfectly but does not show anything in the legend part from a black
polygon.

Is there a way that I can edit the sld file to load attributes from a column
in the same postgres table.

Any help appreciated.
--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html


_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users


Virus-free. www.avast.com


_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic Legend

geowolf
Hi Katie,
GeoServer does not do what you need yet, but the functionality could be added, here is a guide for you:


Cheers
Andrea

On Tue, May 7, 2019 at 2:35 PM Katie Sassenberg <[hidden email]> wrote:

Thanks for the reply Jody,

 

Maybe I should also give an explanation of why I need a dynamic legend. 

 

I’m working on a project where contractors are used for certain jobs.  On the map we need to see which contractor worked where. This is the easy part. My problem comes in when the client adds a new contractor to the database. In the form  for adding a new contractor we also have an option of choosing a colour.   This works great.  My issue is to have a legend that also updates dynamically.  A ready made legend would then have to be updated manually each time a new contractor is added, and we as the developers of the system don’t always know when this happens. 

 

Example of information in my table:

cid:image001.png@01D504BE.57E6F9B0

 

I would like to see in my legend the organization name as a polygon with the colours indicated in the table.

cid:image002.png@01D504BE.6DF8FFF0

cid:image003.png@01D504BE.B9BC2430

 

My sld file:

 

<?xml version="1.0" encoding="UTF-8"?><sld:StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:sld="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" version="1.0.0">

  <sld:NamedLayer>

    <UserStyle>

      <sld:FeatureTypeStyle>

               <sld:Name>organization</sld:Name>      

        <sld:Rule>

               <sld:Title>

                                <ogc:PropertyName>organization</ogc:PropertyName>

                </sld:Title>                        

                <sld:PolygonSymbolizer>

                                <sld:Stroke>

                                                <CssParameter name="stroke">

                                                                <ogc:PropertyName>colour</ogc:PropertyName>

                                                </CssParameter>                            

                                                                <CssParameter name="stroke-width">3.5</CssParameter>

                                </sld:Stroke>

                </sld:PolygonSymbolizer>

        </sld:Rule>

      </sld:FeatureTypeStyle>

    </UserStyle>

  </sld:NamedLayer>

</sld:StyledLayerDescriptor>

 

Katie Sassenberg

 

From: Jody Garnett <[hidden email]>
Sent: Friday, 03 May 2019 20:32
To: Katie <[hidden email]>
Cc: GeoServer Users <[hidden email]>
Subject: Re: [Geoserver-users] Dynamic Legend

 

I think for a few specific cases, such as an SLD Recode function or Interpolate function we could look at the style definition and come up with an legend. If you just have the colors directly listed in your table we could not determine them statically from just the SLD file. 

 

aside: if a developer did want to recognize recode / interpolate functions during legend graphic generation I would I recommend constraining it so polygon symbolizer would just be based on the expression used for fill for example. Rather than do the power set of variations of fill and stroke. This would be a feature request, happy to talk a volunteer through the design, or recommend on of our service providers.

 

One thing I would recommend both of you doing is using the Geoserver style editor to provide an online resource (ie ready made icon) for the style. At the very least this would avoid you having a black polygon.

 

You may also be able to use the Symbology Encoding 1.1 fallback value (which is used if a function is not available) to avoid having the default "black" used.

--

Jody Garnett

 

 

On Fri, 3 May 2019 at 07:20, Katie <[hidden email]> wrote:

Hi all,

I would like to know if someone has solved the Dynamic Legend issue that
Geowolf raised?

I now have the same problem. I have a postgres table that I styled with a
sld using the color attribute from the color column. My map displays the
colors perfectly but does not show anything in the legend part from a black
polygon.

Is there a way that I can edit the sld file to load attributes from a column
in the same postgres table.

Any help appreciated.
--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html


_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users


Virus-free. www.avast.com
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users


--

Regards, Andrea Aime == GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.



_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users