Skip to content

Controls

openlayers.controls

DrawControl

Bases: Control

Draw control

Source code in openlayers/models/controls.py
class DrawControl(Control):
    """Draw control"""

    ...

FullScreenControl

Bases: Control

Full screen control

Provides a button that fills the entire screen with the map when clicked.

Source code in openlayers/models/controls.py
class FullScreenControl(Control):
    """Full screen control

    Provides a button that fills the entire screen with the map when clicked.
    """

    ...

InfoBox

Bases: Control

Info box

Source code in openlayers/models/controls.py
class InfoBox(Control):
    """Info box"""

    html: str
    css_text: str = Field(
        "top: 65px; left: .5em; padding: 5px;", serialization_alias="cssText"
    )

MapTilerGeocodingControl

Bases: Control

MapTiler geocoding control

Source code in openlayers/models/controls.py
class MapTilerGeocodingControl(Control):
    """MapTiler geocoding control"""

    api_key: str = Field(
        os.getenv(MAPTILER_API_KEY_ENV_VAR),
        serialization_alias="apiKey",
        validate_default=True,
    )
    collapsed: bool | None = False
    country: str | None = None
    limit: int | None = 5
    marker_on_selected: bool | None = Field(
        True, serialization_alias="markerOnSelected"
    )
    placeholder: str | None = "Search"

MousePositionControl

Bases: Control

Mouse position control

Source code in openlayers/models/controls.py
class MousePositionControl(Control):
    """Mouse position control"""

    projection: str | None = "EPSG:4326"

OverviewMapControl

Bases: Control

Overview map control

Source code in openlayers/models/controls.py
class OverviewMapControl(Control):
    """Overview map control"""

    layers: list[dict | LayerT] = [TileLayer(source=OSM())]

RotateControl

Bases: Control

Rotate control

Source code in openlayers/models/controls.py
class RotateControl(Control):
    """Rotate control"""

    ...

ScaleLineControl

Bases: Control

Scale line control

Displays rough y-axis distances that are calculated for the centre of the viewport.

Source code in openlayers/models/controls.py
class ScaleLineControl(Control):
    """Scale line control

    Displays rough y-axis distances that are calculated for the centre of the viewport.
    """

    bar: bool | None = False
    steps: int | None = None
    units: Literal["metric", "degrees", "imperial", "us", "nautical"] | None = None
    text: bool = False

ZoomControl

Bases: Control

Zoom control

Source code in openlayers/models/controls.py
class ZoomControl(Control):
    """Zoom control"""

    zoom_in_label: str = Field("+", serialization_alias="zoomInLabel")
    zoom_out_label: str = Field("-", serialization_alias="zoomOutLabel")

ZoomSliderControl

Bases: Control

Zoom slider control

Source code in openlayers/models/controls.py
class ZoomSliderControl(Control):
    """Zoom slider control"""

    ...

ZoomToExtentControl

Bases: Control

Zoom to extent control

Provides a button that changes the map view to a specific extent when clicked.

Source code in openlayers/models/controls.py
class ZoomToExtentControl(Control):
    """Zoom to extent control

    Provides a button that changes the map view to a specific extent when clicked.
    """

    extent: (
        tuple[float | float | float | float]
        | list[float | float | float | float]
        | None
    ) = None