Skip to content

GeomanDrawControl can modify arbitrary shapes on the map #1215

Closed
@riccardoporreca

Description

@riccardoporreca

While the recent deprecation of DrawControl in favor of GeomanDrawControl (and its variant DrawControlCompatibility for compatibility) is in general a clear improvement, there is a key behavior difference: Geoman allows modifying any shapes on the map, whereas the legacy control would only allow modifying shapes that are drawn by the control itself.

Modifying other shapes with the legacy control can still be enabled using transform=True, whereas Geoman does not seem to honor such property nor provide a different mechanism to enable/disable editing shapes via ipyleaflet.

It would be desirable to make GeomanDrawControl and/or DrawControlCompatibility consistent with the existing and more natural behavior of DrawControl, or at least document alternative Geoman-specific ways to control what it allows to modify.

The behavior can be easily assessed with a simple example:

from ipyleaflet import *
m =  Map(basemap=basemaps.CartoDB.Positron, zoom = 4)
m.add(DrawControlCompatibility(position='topright'))
m.add(DrawControl())
m.add(LayerGroup(layers = [
        Polygon(locations=[[0.0, 0.0], [0.0, 10.0], [10.0, 10.0]]),
        Polygon(locations=[[0.0, 10.0], [0.0, 20.0], [10.0, 20.0]], transform=True),
]))
pip list
Package            Version
------------------ -----------
anyio              4.4.0
appdirs            1.4.4
asgiref            3.8.1
asttokens          2.4.1
branca             0.7.2
certifi            2024.2.2
click              8.1.7
comm               0.2.2
debugpy            1.8.2
decorator          5.1.1
exceptiongroup     1.2.1
executing          2.0.1
h11                0.14.0
htmltools          0.5.2
idna               3.7
ipykernel          6.29.5
ipyleaflet         0.19.1
ipython            8.18.0
ipywidgets         8.1.3
isort              5.13.2
jedi               0.19.1
Jinja2             3.1.4
jupyter_client     8.6.2
jupyter_core       5.7.2
jupyter-leaflet    0.19.1
jupyterlab_widgets 3.0.11
linkify-it-py      2.0.3
markdown-it-py     3.0.0
MarkupSafe         2.1.5
matplotlib-inline  0.1.7
mdit-py-plugins    0.4.1
mdurl              0.1.2
mypy               1.10.0
mypy-extensions    1.0.0
nest-asyncio       1.6.0
numpy              1.26.4
packaging          24.0
pandas             2.2.2
parso              0.8.4
pexpect            4.9.0
pip                24.0
platformdirs       4.2.2
prompt-toolkit     3.0.36
psutil             6.0.0
ptyprocess         0.7.0
pure-eval          0.2.2
Pygments           2.18.0
pyproj             3.6.1
python-dateutil    2.9.0.post0
python-multipart   0.0.9
pytz               2024.1
pyzmq              26.0.3
questionary        2.0.1
setuptools         59.6.0
shapely            2.0.4
shiny              0.10.2
shinywidgets       0.3.2
six                1.16.0
sniffio            1.3.1
stack-data         0.6.3
starlette          0.37.2
tomli              2.0.1
tornado            6.4.1
traitlets          5.14.3
traittypes         0.2.1
typing_extensions  4.12.0
tzdata             2024.1
uc-micro-py        1.0.3
uvicorn            0.30.0
watchfiles         0.22.0
wcwidth            0.2.13
websockets         12.0
widgetsnbextension 4.0.11
xyzservices        2024.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions