OpenLayers offers a great number of controls, which are commonly used on mapping applications.
This recipe shows us how to use all of the available controls that have a visual representation. The list includes the OverviewMap
, ScaleLine
, and ZoomSlider
controls, as well as many more.
We will initialize the map with all controls attached but provide a side panel that contains a button for each control so that the user can toggle the controls as they wish. The source code can be found in ch05/ch05-adding-removing-controls
. Here's a screenshot of what we'll end up with:
