[Geoserver-users] Getting the Legend as JSON

Form ArcMap service - we get JSON for Legend similar to this

https://pxxxx.com/arcgis/rest/services/aaa/aaa/MapServer/Legend?f=pjson&token=ddddd.&callback=angular.callbacks._0

angular.callbacks._0({ "layers": [ { "layerId": 1, "layerName": "abc", "layerType": "Feature Layer", "minScale": 0, "maxScale": 0, "legend": [ { "label": "", "url": "76d5be60e5691543860aa46358f5dcf8", "imageData": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAF9JREFUOI1jYaAyYIExzFcw/EeXPBnBwEisPIaBlACYZScjGBjhBmKzjZBrsAGquBDDQGQnU8VAagKqGIjss8HpQgwDKY0MrOmQWmA0HZIH6J8OKSkbqZIOCbqQkrIRAPKcIWF3tuu1AAAAAElFTkSuQmCC "contentType": "image/png", "height": 20, "width": 20 } ] },

Geoserver has the option getlegendgraphics for WMS- which is returning image. I will need something similar as above. I noticed this proposed change: https://github.com/geoserver/geoserver/wiki/GSIP-81—GetLegendGraphic-as-text-(JSON)

Is it part of any release? I am beginner in geoserver and have installed 2.8.2 (stable release) recently. Please advise.

Thanks

Hi,
there is no json support for GetLegendGraphics, the proposal you’re linking to
never got approved and implemented… sorry! :slight_smile:

Also see in the master proposal list, it’s listed below the “deferred and rejected” proposals:
https://github.com/geoserver/geoserver/wiki/Proposals#deferred-and-rejected-proposals

That does not mean it cannot be implemented, one has to check why it got there, fix
the problem (could have been never voted, or had some negative feedback that was
not addressed) and make sure there are enough developer time to actually have it implemented.
See also this page:
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Cheers
Andrea

···

On Thu, Mar 17, 2016 at 3:45 PM, Deepti Puri <deepti202jais@anonymised.com> wrote:

Form ArcMap service - we get JSON for Legend similar to this

https://pxxxx.com/arcgis/rest/services/aaa/aaa/MapServer/Legend?f=pjson&token=ddddd.&callback=angular.callbacks._0

angular.callbacks._0({ "layers": [ { "layerId": 1, "layerName": "abc", "layerType": "Feature Layer", "minScale": 0, "maxScale": 0, "legend": [ { "label": "", "url": "76d5be60e5691543860aa46358f5dcf8", "imageData": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAF9JREFUOI1jYaAyYIExzFcw/EeXPBnBwEisPIaBlACYZScjGBjhBmKzjZBrsAGquBDDQGQnU8VAagKqGIjss8HpQgwDKY0MrOmQWmA0HZIH6J8OKSkbqZIOCbqQkrIRAPKcIWF3tuu1AAAAAElFTkSuQmCC "contentType": "image/png", "height": 20, "width": 20 } ] },

Geoserver has the option getlegendgraphics for WMS- which is returning image. I will need something similar as above. I noticed this proposed change: https://github.com/geoserver/geoserver/wiki/GSIP-81—GetLegendGraphic-as-text-(JSON)

Is it part of any release? I am beginner in geoserver and have installed 2.8.2 (stable release) recently. Please advise.

Thanks


Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140


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

==
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

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.


Note that there is the “GetStyles” request (it’s part of the SLD spec) - this returns the Style used for the layer as XML.

There are various convertors out there to convert XML to JSON - if you plugged one of them in as a piece of middleware between the client which needs JSON and GeoServer which is returning XML, you can probably get the desired outcome.
You can then parse the JSON to determine what the legend should be; easy for simple things (i.e. a polygon with a fill), but probably not desirable for more complex styles.

Cheers,
Jonathan

---- On Thu, 17 Mar 2016 14:45:43 +0000 Deepti Purideepti202jais@anonymised.com wrote ----

Form ArcMap service - we get JSON for Legend similar to this

https://pxxxx.com/arcgis/rest/services/aaa/aaa/MapServer/Legend?f=pjson&token=ddddd.&callback=angular.callbacks._0

angular.callbacks._0({ "layers": [ { "layerId": 1, "layerName": "abc", "layerType": "Feature Layer", "minScale": 0, "maxScale": 0, "legend": [ { "label": "", "url": "76d5be60e5691543860aa46358f5dcf8", "imageData": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAF9JREFUOI1jYaAyYIExzFcw/EeXPBnBwEisPIaBlACYZScjGBjhBmKzjZBrsAGquBDDQGQnU8VAagKqGIjss8HpQgwDKY0MrOmQWmA0HZIH6J8OKSkbqZIOCbqQkrIRAPKcIWF3tuu1AAAAAElFTkSuQmCC "contentType": "image/png", "height": 20, "width": 20 } ] },

Geoserver has the option getlegendgraphics for WMS- which is returning image. I will need something similar as above. I noticed this proposed change: https://github.com/geoserver/geoserver/wiki/GSIP-81—GetLegendGraphic-as-text-(JSON

Is it part of any release? I am beginner in geoserver and have installed 2.8.2 (stable release) recently. Please advise.

Thanks


Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users