ctmm-initiative / ctmmweb

Web app for analyzing animal tracking data, built upon ctmm R package
http://biology.umd.edu/movement.html
GNU General Public License v3.0
34 stars 22 forks source link

Interactive Map Bugs #83

Closed jmcalabrese closed 5 years ago

jmcalabrese commented 5 years ago

1) When plotting location data + home ranges on a map, the checkbox associated with each individual's name toggles both the data and the home range on an off. In contrast, the "home range" checkbox associated with each individual does nothing. I would expect that the name only check box toggles the data on and off, while the home range checkbox toggles the home range on and off. Additionally, perhaps it would be better to have "Name - Data" and "Name - Home Range" checkbox labels, so the function of each is clearer.

2) When zooming in and out, sometimes the data and home range layers on the map don't re-render correctly. This happens frequently when zooming in such that some portion of those elements are off the viewable area of the map, and then zooming back out again. The portions that were outside the viewable area when zoomed in often remain chopped off after zooming back out.

xhdong-umd commented 5 years ago

OK, the first bug was caused by some simplification that had impact on other part which is not fully tested.

The home range list names are used for both home range layer names and home range plot names.

In the beginning home ranges are always named with "name - model", thus we are using name checkbox to toggle points, name - model check box to toggle home ranges. Later we simplified the names, removed the model part if there is no duplications for same animal. Then in map page points layer and home range layer get same name.

To solve this we need to use different names for points and home ranges. It will bring more complexity and prone to bugs if we maintain two set of names for these two places. I think there is two approach here:

  1. add "home range" suffix, so home range plot will have title of "Cilla - home range".
  2. revert back to the "name - model" pattern, which is used anyway when there are multiple models from same individual. This will make the home range plot title a little big longer but I don't think it hurt the readability too much.
xhdong-umd commented 5 years ago

For the zoom in/out, I played for some time but didn't reproduce the behavior. The zoom in/out is handled by the leaflet library, so if there is some bug caused the behavior that probably is not something we can fix.

Since I cannot reproduce the error, maybe you can turn on shiny debug information with options(shiny.trace = TRUE), and play with the maps. When the error appeared again, is there any error or warning shown in the R console (there will be lots of information printed all the time, I'm hoping there was some silent error/warning captured here)?

xhdong-umd commented 5 years ago

I added "home range" suffix to home range plot and layer names in map. It's quite tricky since we are maintaining two set of names by condition, and color mapping depend on names, and there are several options will modify the title (variogram pool, multi schedule, home range weights). All the headaches will not happen if we kept the single consistent unique name in "id - model" pattern.

Since we have the feature implemented 80% already, I still fixed the conflict in home range part by adding new code. If in the future this caused more problem maybe we should just use the single unique name.

xhdong-umd commented 5 years ago

The home range layer selection fix has been pushed to master branch.

I tried to change the data layer name with "name - data" pattern, but found there are too many places need to be changed. This is similar to the case of simplifying the name -- the name is used to pick out data, draw the data, mapping colors, label the layer in map, so we will need to maintain two set of name, one as actual id, one as displayed name. There are also several user oriented functions to build map from data in one line, they also need to be changed. I need to make sure all of these to be changed consistently

So this can be done but it's not a simple fix and must be done very carefully. Considering the data points plots are just named by animal name, maybe the name only pattern is consistent from other page and not too hard to understand?

For the zoom problem, there is nothing in out side dealing with zoom, so it could be a problem of supporting library (leaflet and related). If the problem can be reproduced reliably, I can try to find the cause and report the bug to the related library authors.