The Scale control displays a map scale element. This control is not enabled by default.
First of all, if you want to render a scale control, you will need to build one. So let's go:
use Ivory\GoogleMap\Control\ScaleControl;
$scaleControl = new ScaleControl();
The scale control constructor does not require anything but it accepts parameters such as position (default bottom left) and style (default default):
use Ivory\GoogleMap\Control\ControlPosition;
use Ivory\GoogleMap\Control\ScaleControl;
use Ivory\GoogleMap\Control\ScaleControlStyle;
$scaleControl = new ScaleControl(
ControlPosition::BOTTOM_LEFT,
ScaleControlStyle::DEFAULT_
);
If you want to update the scale control position, you can use:
use Ivory\GoogleMap\Control\ControlPosition;
$scaleControl->setPosition(ControlPosition::BOTTOM_RIGHT);
If you want to update the scale control style, you can use:
use Ivory\GoogleMap\Control\ScaleControlStyle;
$scaleControl->setStyle(ScaleControlStyle::DEFAULT_);
After building your scale control, you need to add it to a map with:
$map->getControlManager()->setScaleControl($scaleControl);