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

Geonotebook map doesn't render if point annotation is added programmatically. #124

Open
Gustavohernandez1 opened this issue Jun 28, 2017 · 4 comments
Assignees

Comments

@Gustavohernandez1
Copy link

I am currently adding a point annotation to the map programmatically and it does not appear. I can use the following command to see if the point was created "M.layers.annotation.points" and it is listed on the map. I can clear the point from the map and create it again, but I can never see it. If I create the point and refresh the page, the map loads again with the point visible on the map and listed, but then it cannot be removed and any other annotation added cannot be removed as well. Only by going to kernel and choosing to "restart & clear output" will the annotations disappear. I will include a few steps and 2 images.

Steps:
1.Adding annotation point to the map programmatically
2.Reload page without deleting the point
3.Point appears on the map. Deleting the point does not make it disappear from the map or list.

Here is a snippet of the issue before reloading the page.
screen shot 2017-06-28 at 3 48 30 pm

Here is a snippet of the issue after refreshing the page.
screen shot 2017-06-28 at 3 50 20 pm

@aashish24
Copy link
Member

Thanks for reporting @Gustavohernandez1

@jbeezley
Copy link

I believe this issue is related: #97

@jbeezley
Copy link

To expand on the issue, there is a problem with the RPC messages when reloading the page. Some calls made from the client after a refresh have an invalid comm id. I have reproduced this with both the geojs and openlayers renderers. @kotfic is probably the most knowledgeable in this area.

@kotfic
Copy link
Contributor

kotfic commented Jun 29, 2017

@Gustavohernandez1 while @jbeezley is right that there are some issues with refreshing and comm stuff, this actually looks like a much more simple problem.

Currently you are calling M.layers.annotation.add_annotation and you should be calling M.add_annotation - I'm sorry the documentation wasn't more clear on this!

M.add_annotation is the RPC function that add's an annotation to the javascript map, once the annotation has been successfully added the javascript function returns and the python callback function M.layers.annotation.add_annotation is called. When you call M.layers.annotation.add_annotation on the server side this adds the annotation server side, but not client side. When you refresh that state is communicated down to the client side and the point that was not visible before appears.

The fact that the annotation doesn't clear after refresh is however a bug, I will see if i can track down why that is happening.

Either way, I will put together a small PR that converts M.layers.annotation.add_annotation to M.layers.annotation._add_annotation so it is a little more clear that the callback function should not used.

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

4 participants