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:
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 :smile: ...), a cluster persists even at maximum zoom:
clicking on the cluster "opens" it
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')]
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.
Context
I have a component built upon
ipyleaflet
to streamline the interactive exploration of geo-located data inxarray
.This worked on the assumption that an
on_click
event on aMarker
would contain the exact geo-coordinates at which the Marker was created. However if some markers are geographically very close, and perhaps becauseMarkerCluster
is used, this fails to work.Example
I have ~1500 points with streamflow monitoring sites:
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 :smile: ...), a cluster persists even at maximum zoom:
clicking on the cluster "opens" it
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 https://github.com/jmp75/ipyleaflet-dashboard-tools/issues/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.