geostyler / geostyler-legend

Small library to render map legends with OpenLayers and d3
BSD 2-Clause "Simplified" License
12 stars 9 forks source link

Legend generation fails on multiple symbolizers or OL style function #285

Closed raitisbe closed 2 years ago

raitisbe commented 2 years ago

Bug

Describe the bug The problem stems from renderer.setStyle(styleItem); line, where setStyle only accepts an OlStyle object, not an array or function. In that case catch block is executed, the promise is rejected and no legend is generated.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://geostyler.github.io/geostyler-demo/

  2. Add an additional Icon symbolizer to the existing Mark symbolizer

  3. Expand Legend tab

  4. Set some attribute for Mark symbolizer, radius for example, so the icon gets regenerated: image

  5. See error in console and empty legend graphics on the right side: image

Expected behavior getRuleIcon function should return an icon by combining the multiple OlStyles and generating a composite icon such as: image

Screenshots See above

Desktop (please complete the following information):

KaiVolland commented 2 years ago

Thanks for the report. I'll have a look at it.