Open lin-d-hop opened 3 months ago
After some preliminary investigations... Mapbox gl doesn't allow markers to be moved. There is a chance we could implement markers via the mapbox gl 'feature' functionality, however this might break our clustering implementation
Quick spike to see what happens. If anything breaks, let's update the issue here and close it.
Getting this at the moment:
@rogup is the below code sufficient for a quick test? The correct way, I guess, would be to create a bespoke feature from scratch more akin to our polygon and lines.
@lin-d-hop, I'll wait to see what @rogup says about the above before closing.
@ms0ur1s I think that error is because an expected prop hasn't been given, so I don't know if it's using Features that is necessarily the problem.
I had another quick look at how polygons and lines are editable and can see that we use the react-mapbox-gl-draw
drawControl component. So I think we don't actually need to implement our own onDragStart/End methods, and could do the same for markers.
I think it does seem doable to display markers in this way, as a GeoJSON layer of Point features, and then feed in the features to drawControl. This would make how we display markers, polys and lines more consistent. I found this library too, which I did a really quick test with, and it looks like clustering will still work https://www.npmjs.com/package/react-mapbox-gl-cluster
The branch I played with: https://github.com/DigitalCommons/land-explorer-front-end/commit/09d082d88054d2e2e492c3ad533e0ae1d1285d67
So I think making markers moveable is possible, but wouldn't be a really quick fix (it would probably take 1-2 days)
@rogup, thanks man. Funnily enough, when I was doing a little digging in the react-mapbox-gl documentation I had a similar though about the GeoJSON layer of Point features. The cluster library is a great find.
If @lin-d-hop is happy to go ahead, do you think these changes are within my capabilities, if I use your initial work as a starting point and make sure give you a shout when I encounter any difficulties?
Yeah I think it's something that you can do :) And learning about how stuff is rendered in Mapbox is probably a useful thing, since it relates to your frontend UI expertise and might be related to work we do soon on Mykomap too.
Happy to answer any questions or jump on a call to give any guidance. The structure of data in GeoJSON and the way that feature IDs work is something that I have been working on a lot recently (with property boundaries)
Thanks @rogup for all your help and patience, as usual. 😀
@lin-d-hop, in light of Rohit's comments are you happy for me to carry on with this as a dev ticket?
@ms0ur1s Short answer - sure go for it Long answer - 1-2 days is pretty significant for this, particularly as I expect Marcel's actual time vs Rohit's estimate won't actually be the same. I would say park it, but:
So yeah, progress on the caveat that this is low priority and if other things come in in the meantime we will be parking it.
Thanks @lin-d-hop, understood. Also, if I get any sense that I'm hitting a brick wall I reach out to @rogup.
Cool, yes, rule of thumb - don't be stuck for an hour. Reach out!
Describe the bug In the Drawing Tools menu of LX the Edit option allows the user to edit the points in a line or a poly. However when you click an existing marker you can't do anything. It would make sense to also be able to edit the location of a marker.
To Reproduce Steps to reproduce the behavior:
Expected behaviour When you click on a marker after clicking edit you should be able to drag the marker to a new location