gm3
gm3 copied to clipboard
ags-vector legend
It would be useful for ags-vector legends to automatically generate (currently you can manually specify an html legend). For an example see the railroads layer in the demo, where the style is specified in the mapbook.xml (the legend is set to off in the catalog but turning it on doesn't generate the legend based on the style)
Yes, it can be a pain.
Currently all the the map-source types support a <legend> tag in the map-source to define a legend graphic to be shown in the catalog panel. The legend type can be "img" or "html" and these must be created by hand (by you). In addition, "mapserver" (and wms? I need to test wms!) type map-sources (which return rendered images for the map) can request a legend graphic from the server, so some automation there.
The rendering of vector map-sources (type=vector, geojson, WFS, mapserver-wfs, ags-vector) is done on the client, and currently the <style> tag in the map-source defines what they will look like on the map according to MapBox GL Style syntax. But you must code the legend in HTML/CSS. Yikes!
One "cheat" is to code the
<legend type="html"><![CDATA[
<img src="logo-mini.png"><span style="color:green">GeoMoose Sightings</span><br>
]]></legend>
It would be nice if type="ags" (the image flavor map-source) would request a legend graphic from the server and display that.
Personally, I don't find vector map-sources all that useful, unless you plan on allowing user editing. And there's not much point in that unless they can save/restore their edits (I remain hopeful about WFS-T functionality!).
This issue is at risk of replicating the wide ranging discussion that was on the email list. I think the extent of this issue should be "ags-vector legend" and specifically is pulling out this from the email list:
"In GeoMoose, vector layers are styled and rendered in the browser rather than by the server. Thus, I would expect legends for ags-vector to behave the same as any other vector layer. If that isn't currently the case for ags-vector then that is an oversight/bug."
https://lists.osgeo.org/pipermail/geomoose-users/2020-June/006781.html
The wide ranging discussion is certainly useful but perhaps better on the email list than on this narrow issue. There may certainly be other issues that arise from the wide ranging email list discussion, but they should each get their own issues.
So I tested a WMS map-source, and yes it can automatically request a legend graphic. But ArcGIS Server WMS legends are somewhat limited (no text):

In the catalog section, add the legend attribute:
<layer src="wms-feature/2" legend="true">
And show-legend is useful to set the initial show/hide state when using legend-toggle="true".
@elil , In general I agree. I think issues should be for filing bugs and requesting new features. But lately I've found myself using them to record documentation info (bugs on the doc?). And the mailing list can be challenging to include even modest sized snapshots (can that be fixed?) and formatted code (that may be my problem).
Closing as "won't fix". we have the HTML and static image legend support.
AGS has proven to be an unstable target and also generated ugly images.