-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GeomanDrawControl can modify arbitrary shapes on the map #1215
Comments
Hey @riccardoporreca! Thanks a lot for the issue, I think we should indeed at least match the old behaviour here. I'll take a look at this next week. |
@iisakkirotko, I was digging this a bit myself, and I might have found an easy way to control the Geoman behavior. According to https://www.geoman.io/docs/getting-started/free-version#exclude-layers
I gave it a quick try by simply adding pm_ignore = Bool(True).tag(sync=True, o=True) to the definition of the top class
and this seems to work well in disabling editing by default, possibly re-enabled via from ipyleaflet import *
m = Map(basemap=basemaps.CartoDB.Positron, zoom = 4)
m.add(DrawControlCompatibility(position='topright'))
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),
Polygon(locations=[[0.0, 20.0], [0.0, 30.0], [10.0, 30.0]], pm_ignore=False),
Polygon(locations=[[0.0, 30.0], [0.0, 40.0], [10.0, 40.0]], transform=True, pm_ignore=False),
])) Note that, in fact, I am happy to contribute a small PR, with the inclusion of |
Hey @riccardoporreca! I was just looking at this myself, and noticed that If you want to contribute a PR, I'd be happy to take a look at it. Let me know if you need a hand with any of it, you can reach me here, or at [email protected]! |
@iisakkirotko, here you go: #1220 |
While the recent deprecation of
DrawControl
in favor ofGeomanDrawControl
(and its variantDrawControlCompatibility
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/orDrawControlCompatibility
consistent with the existing and more natural behavior ofDrawControl
, 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:
pip list
The text was updated successfully, but these errors were encountered: