-
Notifications
You must be signed in to change notification settings - Fork 507
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
Upgrade LeafletJS to 1.x #357
Comments
This came around on R-pkg-devel today https://mailman.stat.ethz.ch/pipermail/r-package-devel/2017q1/001256.html Quote @eddelbuettel :
|
Let's not decide on any solutions until we know how bad the breakage is. I'm going to spend some time on Leaflet starting next week, and can start with Leaflet 1.0 testing. I don't feel comfortable though releasing 1.1 of this package to CRAN until we at least have some confidence that we're not going to have to drop any of the recently introduced features (I don't think it's likely, but better to know). |
FWIW I do think that eventually everything will work with 1.x and the situation is not terrible. I agree with your concerns regarding pushing the new stuff in the package to CRAN. Would you have a few mins to discuss this over a call? |
Woohoo, Proj4Leaflet just published 1.0 support kartena/Proj4Leaflet#126 |
I'd like to help in this effort. Should we create a project https://github.com/rstudio/leaflet/projects under this Github repo to track progress? |
I have already started a bit of work on 1.0. But would love to cooperate. @timelyportfolio For leaflet we're already using waffle.io https://waffle.io/rstudio/leaflet. |
Do we have a working |
Actually I am swamped with personal stuff + work stuff. Don't let me hold you back. |
So, anybody out there listening, just to confirm no one else is working or has worked on this problem? I just want to make sure that in a world of scarce resources that I am not duplicating efforts. Thanks! |
I'm not working on it either yet. |
Is there an expected timeline? And how detrimental will this update likely be for existing leaflet functionality? |
wish me luck :) https://github.com/timelyportfolio/leaflet/tree/v1.0 |
Don't expect this to be easy, but R and JS tests all pass. Now, for the hard slog... |
I won't be too encouraged with the tests passing. They are fairly rudimentary ;) From my notes here're a couple of things to watch out for.
Some big plugins you'll need to watch out for
|
Thanks for the headstart. Hopefully I can add some more tests that will help in future since the cadence for leaflet is now much quicker. I will try to log all I find in https://github.com/timelyportfolio/leaflet/blob/v1.0/inst/errors/errors.Rmd. |
@timelyportfolio One more note. Don't edit |
@jcheng5, I noticed that many of the initial control plugins do not remove properly (not leaflet >1.0 problem since doesn't work currently). I then discovered the "new" |
@timelyportfolio Sample code for the issue? |
@bhaskarvk, thought you were busy :) Failing ControlsThese controls work "fine", but we had added code to insure that controls are not added twice. layers lines leaflet-measure lines Here is the
seems to work, but if we inspect the JavaScript console, we see Broader ProblemWe could solve this by notifying on the |
Bugs always bug me :) If you look at https://github.com/rstudio/leaflet/blob/master/javascript/src/methods.js#L668, You will notice that |
Also from your working example, I think it's a mistake to add layersControl and measure-control directly to the map bypassing ControlStore. |
I think all controls are being added/removed in this way, since they predate |
ControlStore is not new, it's been there for a while. What is new is some time mid last year @jcheng5 broke up the monolithic leaflet.js into smaller pieces and used grunt to assemble the final JS. |
Also all what I said about ControlStore, also holds valid for LayerManager. No layers should be directly added to the map. |
ignore what I previously wrote, sorry |
Ok, @bhaskarvk and @jcheng5, I think I have updated leaflet and all plugins to their most recent versions in https://github.com/timelyportfolio/leaflet/tree/v1.0. I tested with all examples in documentation and inst/examples, and I believe I have resolved all issues (very few) that I found. If you have some time, I would very much appreciate if you could test locally.
I'll put out a call on social media for testers once I hear back from you. |
I just glanced at the code changes and looks good to me. Of course I'll need to change But really good job. |
Thanks @timelyportfolio! |
From a first quick tests, I see that raster images are not shown anymore leaflet() %>% addTiles() %>% addRasterImage(mapview::poppendorf[[1]]) Other than that pretty much all the code from my |
thanks everyone for testing so quickly. I'll debug @tim-salabim raster issue. |
@tim-salabim |
well |
Issue mentioned above now resolved 96667e3 and 83bee11, but left with two lingering items:
|
@timelyportfolio Any more updates on this ? Anything I can help out with ? |
With the raster issue #357 (comment) in particular, or all Leaflet > 1.*? I have not circled back to fix the remaining raster problems discussed. In terms of Leaflet > 1.* , should we create a centralized branch to work through and test while still merging existing/recent pull requests? |
@timelyportfolio I might take a stab at this remaining issue sometime next week. Will let you know how it goes. |
@timelyportfolio Leaflet 1.1.0 released. Unfortunately no time to work on this before UserR. |
Picking up where @timelyportfolio left off. Firstly 1.1.0 is a no go as far as tile loading. I just put 1.1.0 js/css and the tiles are not loading , which sucks coz for the time being we're stuck w/ 1.0.3 unless I figure out what's wrong. For now looking at the raster issue. |
let me know how I can help. don't remember much but I think just needed to bring to front or change z-index. |
1.1.0 is supposed to have fixed that., but for now I am having trouble getting tiles to showup properly w/ it |
1 similar comment
1.1.0 is supposed to have fixed that., but for now I am having trouble getting tiles to showup properly w/ it |
I believe I was able to find and fix the raster issues, at least the ones where tiles appear over the raster and the raster not being redrawn. example I also don't seem to find any problem with upgrading Leaflet to 1.2.0, but I didn't commit any changes other than the minimum needed to fix the rasters. I've created a PR for v1.x here: #453 There are a couple of remaining work items that I can think of, I'll add them to the PR description. This thread has gotten a little unwieldy, maybe we can take the discussion over there. |
Awesome news. Although I would recommend that you keep this for now as Github only and allow me some time to also migrate leaflet.extras to 1.x set of plugins. Because of the scope of extras package I'll have to go thru each and every plugin to make sure that it works with 1.x so I will need some time to make it 1.x ready. |
@bhaskarvk It's not possible for these plugins to be both 0.7 and 1.x ready, right? They will be compatible with either one or the other? If that's the case I think we might need to talk about how we're going to roll all this out. |
It's on a case by case basis. Some plugins support both leaflet versions simultaneously, while others have different releases targeting diff. leaflet versions. Some have been abandoned a while ago and may need fixing to work in leaflet 1.x. |
Fixed in #453 |
The issue
Now that LeafletJS 1.x has been out and stable for a while, it's time to think about upgrading to it. However it's not as simple and as straight forward as it sounds, so I'm creating this issue to capture all information related to the upgrade.
Initial Assessment
The first order of thing is to adapt any existing code to use 1.x API, and the good news is that not much has changed, so most of the code can work as is. The only two things I am aware of are
These are both minor changes can can be done only on the JS side w/o having to rewrite the R API.
Now for the hard parts.
The hardest part is going to be upgrading the plugins used. As plugins are individual contributions, it is up to the plugin author to migrate to 1.x and unfortunately not all have done so. We need to review this on a case by case basis. Starting with Proj4Leaflet which is critical in supporting custom projections. Proj4Leaflet hasn't been fully migrated to 1.x, but a branch does exists claiming to support 1.x. The problem is that the maintainer of Proj4Leaflet has not found spare time to work on it in a while and the branch is > 6 months old.
Next are some other plugins we use in the package such as AwesomeMarkers, Measure, Minimap, Terminator, omnivore, leaflet-providers, Easybutton, marker cluster, location filter (for crosstalk).
The repos of all these plugins needs to be examined and we need to determine what efforts will require for each of them.
Lastly we have the leaflet sup-packages, starting with leaflet.extras (by your's truly), and mapview. These two use a lot of leaflet plugins and they too must be examined for the level of efforts required.
The benefits
Action Plan
@jcheng5 @hadley @timelyportfolio @tim-salabim @mdsumner Please provide your inputs on this. This is quite critical in keeping the package up to date and viable for the coming years.
One thing you guys can help out immediately is discussing whether this needs to be a new package (leaflet2), or simply continue with the same name. I don't think compatibility is going to be an issue for users of just this packge, but for sub-package it could lead to problems if we retain the same name. e.g. some plugins in mapview / leaflet.extras may not have been ported to 1.x, and ergo won't work with the latest leaflet package (if we were to retain the same name).
The text was updated successfully, but these errors were encountered: