Search code examples
openlayersopenlayers-6

How to change the default icons in openlayers 6 and ol-ext?


I need to change the default icons (zoom and attribution) and the search icon (with search box) for ol-ext on my Map. In which way can I do that?


Solution

  • The zoom control does not use icons, the + and - are text, but you can specify an element using the zoomInLabel and zoomOutLabel options https://openlayers.org/en/latest/apidoc/module-ol_control_Zoom-Zoom.html In the case of attribution the equivalent options are label and collapseLabel https://openlayers.org/en/latest/apidoc/module-ol_control_Attribution-Attribution.html In ol-ext the icon is the background-image in the css, so you would need to use you own css to update it.