geomoose / gm3

GeoMoose 3.0 Development. Please submit pull requests to the 'main' branch.
https://www.geomoose.org
MIT License
58 stars 59 forks source link

ags-vector legend #556

Open chughes-lincoln opened 4 years ago

chughes-lincoln commented 4 years ago

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)

brentfraser commented 4 years ago

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