Skip to content
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

Creating multiple polygons without repeatedly clicking the DrawControl #795

Closed
giswqs opened this issue Feb 28, 2021 · 3 comments
Closed

Comments

@giswqs
Copy link
Contributor

giswqs commented Feb 28, 2021

Is it possible to create multiple polygons without repeatedly clicking the DrawControl? I need to create many polygons as training samples. Currently, the DrawControl only allows creating one polygon at a time. Clicking the DrawControl repeatedly is inconvenient. Thanks.

@davidbrochart
Copy link
Member

Is it possible to create multiple polygons without repeatedly clicking the DrawControl?

Not to my knowledge.

@giswqs
Copy link
Contributor Author

giswqs commented Feb 28, 2021

Is it possible to create multiple polygons without repeatedly clicking the DrawControl?

Not to my knowledge.

Is there a way to listen to the DrawControl and find out which tool (e.g., marker, polygon) has been clicked?

@giswqs
Copy link
Contributor Author

giswqs commented Mar 1, 2021

It turns out there is a repeatMode option. Setting repeatMode=True solves the issue.

https://leaflet.github.io/Leaflet.draw/docs/leaflet-draw-latest.html

draw_control = DrawControl(
    marker={"shapeOptions": {"color": color.value}, "repeatMode": True},
    rectangle={"shapeOptions": {"color": color.value}, "repeatMode": True},
    polygon={"shapeOptions": {"color": color.value}, "repeatMode": True},
    circlemarker={},
    polyline={},
    edit=False,
    remove=False,
)
edit.mp4

@giswqs giswqs closed this as completed Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants