I believe this would let me initialise the polygon draw mode from a button that I control (separate from the geoman UI), but I can’t figure out how to access map.pm so that I can call the enableDraw method.
I have used the wrapper from your example, and everything works perfectly, but the ref on the FeatureGroup doesn’t appear to give me access to map.pm.enableDraw, at least not in the ways I have tried (things like ref.current.pm.enableDraw and variations). Is there a way to do this?
My goal is to be able to have a couple of buttons on a UI that I have overlaid on the map, with labels such as "Create a polygon" and "Create a circle" to get the user started, which would have the same effect as pressing the corresponding icons in the Geoman toolbar.
I was able to solve this by adding a ref on the MapContainer and then passing it down to the GeomanWrapper component. Apologies for the noise, closing.
It feels like I’m missing something obvious, but I can’t figure out how to do stuff like this:
I believe this would let me initialise the polygon draw mode from a button that I control (separate from the geoman UI), but I can’t figure out how to access
map.pm
so that I can call theenableDraw
method.I have used the wrapper from your example, and everything works perfectly, but the
ref
on theFeatureGroup
doesn’t appear to give me access tomap.pm.enableDraw
, at least not in the ways I have tried (things likeref.current.pm.enableDraw
and variations). Is there a way to do this?My goal is to be able to have a couple of buttons on a UI that I have overlaid on the map, with labels such as "Create a polygon" and "Create a circle" to get the user started, which would have the same effect as pressing the corresponding icons in the Geoman toolbar.