Friday 5 July 2019

How to call Legend end points of multiple layers published from Geoserver?


I have map services published from ArcGIS server being called from Angular- Leaflet app and we are displaying the legend (controlled through map controls) from https://pxxxx.com/arcgis/rest/services/aaa/aaa/MapServer/Legend?f=pjson&token=ddddd.&callback=angular.callbacks._0



and receiving the Json as below based on layerID 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 } ] }, { "layerId": 3, "layerName": "xyz", "layerType": "Feature Layer", "minScale": 750000, "maxScale": 0, "legend": [ { "label": "", "url": "0c13bfd1080ed2b63ddc93e033c6739e", "imageData": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAElJREFUOI3t1DEKACAMA8AIfi+vzQPrVEFwqpmkmTpdM2XCnAkAkuIVIjk26IikIDkOML9UsLxtDRtssMGPQccu2hoeA1vdwVsWVeQROSDODxUAAAAASUVORK5CYII=", "contentType": "image/png", "height": 20, "width": 20 } ] },


The most complex map service consists of 53 layers and there are some more services. We are planning to switch to geoserver. Geoserver's getlegendgrahics works only for one layer at one time. So almost feels like there has to be 53 + calls just to gather legend info (unless I am missing something). Also legend in current application are being displayed based on the max and min scale through map controls- which in case of geoserver are stored in SLDs- is there any workflow similar in geoserver e.g. what will be the end point to use SLD info? (it may sound as 2 questions but both are from same context and very much related.)




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...