User interaction with layer (e.g. to edit a polygon) #856
Replies: 2 comments 1 reply
-
I don't know if this is still an issue but we ran into the exact same problem, hopping to find a better solution. Our only solution was to open up a webview and load the JS version of maplibre and follow this https://maplibre.org/maplibre-gl-js-docs/example/mapbox-gl-draw/. It does work but isn't great. For example if a user doesn't have an existing element they want to modify, such as creating a new element, we would like to use their current GPS location. On Android this isn't too much of a problem, but with iOS it will then re-prompt the user using a rough dialog asking for GPS permission again. |
Beta Was this translation helpful? Give feedback.
-
Actually we managed to solve it and released our solution as a small library 😊: https://github.com/ramani-maps/ramani-maps/ |
Beta Was this translation helpful? Give feedback.
-
I see that one can draw lines/polygons on a layer, e.g. like described here. Seems like a lower-level API than an annotation, which is fine 👍.
I believe I get how I could draw a polyline/polygon given a list of global geo coordinates. But what if I wanted the user to be able to edit the polygon? Say the user can define an area on the map by moving (drag-and-drop) the corners of that polygon on the map.
Would that be possible? I guess it would require a way to transform the local coordinates of the touch (given by a
MotionEvent
maybe?) to a global geo coordinate for the map, right?Beta Was this translation helpful? Give feedback.
All reactions