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

Close Markers in MarkerClusters: the "coordinates" of an on_click event may not the ones of the marker initially created #1207

Open
jmp75 opened this issue Jun 13, 2024 · 0 comments

Comments

@jmp75
Copy link
Contributor

jmp75 commented Jun 13, 2024

Context

I have a component built upon ipyleaflet to streamline the interactive exploration of geo-located data in xarray.

This worked on the assumption that an on_click event on a Marker would contain the exact geo-coordinates at which the Marker was created. However if some markers are geographically very close, and perhaps because MarkerCluster is used, this fails to work.

Example

I have ~1500 points with streamflow monitoring sites:

image

zoming in on to most area, markers "ungroup" as expected, and clicking on each marker triggers a successful action based on the click lat/lon information.

Zooming in on to a location (the Marne river in South Australia, not the one in Europe 😄 ...), a cluster persists even at maximum zoom:

image

clicking on the cluster "opens" it

image

but then clicking on one of the icon triggers a KeyError: (-34.67698205588844, 139.24381256103518) as coordinates are not exactly the same as expected: [((-34.6743, 139.2319), 'A4260529'), ((-34.6741, 139.2317), 'A4260605')]

Related links

More details in jmp75/ipyleaflet-dashboard-tools#2

One workaround may be to not use MarkerCluster as in ipyleaflet issue #498 . But I'd like to keep MarkerCluster and find another way to circumvent this issue.

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

1 participant