Closed egemen-dev closed 1 year ago
Hi, just stumbled upon your issue, I would like to guide you towards solving this with Google Maps' Marker Cluster feature. I have encountered this same issue on my risk-viz project. Only using marker cluster would not be enough since if you have multiple markers at the exact same location, Google Maps wouldn't show them all. In the end I used marker cluster, with a helper function which adds a little bit of variance to the lat,long data so it shows up perfectly. Hope it helps!
Hey @egemen-dev thank you for opening this. This would be a great addition.
There's a couple of related issues, as you have pointed out. They should be done in this sequence:
SuccessesController::GoogleMapsCoordinates
. This is an overly complex approach, however, and I did not bother to maintain metadata like dog name etc. and never got round to adding it. In retrospect, the approach is excessive and instead I think we can just apply a random deviation to every single location's Lat and Lon, and easily maintain the metadata for the pin (name, breed, etc). As such, I think this class should be refactored accordingly (could keep the class and refactor/rename the create_raw_collection
method to create an array of objects with deviated coordinates and metadata for the view. The rest of the logic can probably be deleted). I like the idea of @luuu-xu solution using clusters...but I don't think we need to do that just yet. Perhaps that can come in another issue once the map starts to look very busy.
Let me know if you want to tackle all of this. If you have any questions I am happy to discuss.
This PR now merged: https://github.com/kasugaijin/baja-pet-rescue/pull/160 So this issue is now unblocked and we can add meta data to dog pins. See my comment on the PR.
Thanks
Closed.
I copied the repo and got it running on my local environment to experiment adding clickable pins and meta data. Here is the preview. I might open a PR after this. https://github.com/kasugaijin/baja-pet-rescue/issues/144
My question is, the reason to apply random values to the duplicate locations (https://github.com/kasugaijin/baja-pet-rescue/issues/134) because if the same person adopted multiple pets it's nearly impossible to individually display them on the map - they overlay each other, is that right or something else? @kasugaijin