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

Measure distances and area tool bugging? #1076

Open
PennyJClarke opened this issue Nov 22, 2022 · 7 comments · May be fixed by #1171
Open

Measure distances and area tool bugging? #1076

PennyJClarke opened this issue Nov 22, 2022 · 7 comments · May be fixed by #1171

Comments

@PennyJClarke
Copy link

The measure distances and area tool appears to have a bug when used in Jupyter notebook, has anyone else experienced an issue?

When I click on the map to begin a measurement the screen shifts on each click (a uniform amount) and the start of the intended measure point shifts? This video demonstrates the issue:

Leaflet_error.mp4

This error occurs on the basemap, without having added additional layers, ruling out a projection issue.
I am trying to use ipyleaflet through leafmap, and so I also created a new environment containing only Leafmap, to confirm it was not a package conflict, and the error still occurs.

The use of the measure tool is integral to my use of ipyleaflet/leafmap, I thank you for any time, support and guidance you can offer.

@giswqs
Copy link
Contributor

giswqs commented Nov 22, 2022

I can confirm this bug. Downgrading ipyleaflet to an older version (e.g., v0.15.0) still has the same issue. I used the measure tool in the past, and it worked fine. This bug is probably caused by some ipyleaflet dependencies, but I am not sure which one.

Peek 2022-11-22 14-08

@PennyJClarke
Copy link
Author

PennyJClarke commented Dec 5, 2022

Thank you @giswqs, do you think if I went further back in ipyleaflet versions this could solve the issues. The measure tool does work in Leafmap when using a Folium backend (as you suggested I try), but I need the ability to overlay raster images and to use the functions to work codeless, that come with Leafmap ipyleaflet backend.

Is anyone able to help with fixing this bug, please?

Thank you in advance for guidance and support.

@Itayor
Copy link

Itayor commented Dec 27, 2022

I noticed this bug on versions 0.17.1 and 0.17.2, but it work well on versions 0.16.0 and version 0.17.0

@iacisme
Copy link

iacisme commented Dec 29, 2022

I too am experiencing this issue.

ipyleaflet version = 0.17.2

I was using leafmap and noticed this issue. I went online and found this 311 on the leafmap github, and that lead me to here.

I was trying to measure the distance from the black pin to the outer black circle, and this is the result in leafmap:

image

One thing I've noticed is that in the lower right corner, the map attributions show up twice, is that normal?

Here's hoping someone has thoughts or ideas of how to fix? One of the reasons I switched from folium to ipyleaflet and leafmap was because folium doesn't work with ipywidgets interactive_output. If I switch to a folium backend, will that limit me in making interactive maps with ipywidgets? I'm asking because I'm going to need to make radio buttons and check boxes and don't want folium to be my limitation.

Thanks!

@giswqs
Copy link
Contributor

giswqs commented Dec 29, 2022

The attribution issue has been fixed by the latest version of leafmap. Update it using !pip install -U leafmap. Most of the ipyleaflet controls have the same issue. Setting m = Map(attribution_control=False) will hide the attribution control, but if you use m = Map(attribution_control=True), it will show the attribution control twice, which is unexpected. I am not sure if ipyleaflet wants to take on this issue.

The measure control issue is indeed an ipyleaflet issue. There is not much leafmap can do about it. It needs to be fixed by iypleaflet.

@PennyJClarke
Copy link
Author

@Itayor, thank you so much for suggesting to downgrade to 0.17.0, the measure tool does indeed now work! While the bug is not removed from newer ipyleaflet, and it would be great for ipyleaflet to look at this in the future. This suggestion allows me now to measure in Leafmap, hopefully downgrading does not compromise the rest of Leafmap's functions as it is such a great package! Thank you all for your help!

@Itayor
Copy link

Itayor commented Nov 28, 2023

Update - checked now ipyleaflet 0.18.0 with MeasureControl
the bug still exists, but there is a workaround
if you set keyboard to 'False' in Map, the glitch happens on first click only. as long as the map still draggable, you can easily go back to your location, and continue with the shape.
I guess that there is some interaction between measure control and keyboard that causes this bug. did not find a way to overcome it completely, but I guess this should help.

I don't know if it would work for previous versions (like 0.17.2)

@gjmooney gjmooney linked a pull request Jan 17, 2024 that will close 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

Successfully merging a pull request may close this issue.

4 participants