Bhaskar Karambelkar's Blog

Leaflet Diary: Chapter 4, Towards Version 1.1

 

Tags: r r-stats rstats GIS leaflet Leaflet-Diary


This is the fifth blog entry in my series ‘Leaflet-Diary’. In my last post Chapter 3, Making Leaflet Extensible, I talked about changes that were made to the Leaflet package to make it extensible. This one is about phase IV, making the Leaflet package ready for a CRAN version upgrade.

TL;DR

  • A major issue related to missing or incomplete data was fixed.
  • Shapes (Polylines/Polygons/Circles/Rectangles) can now be easily highlighted on mouse over.
  • Leaflet Documentation has been updated.
  • Fingers crossed for 1.1 CRAN release.

Long Read

Missing Data

Leaflet had issues handing entirely empty data (A Spatial object with no geometries), or even data with missing values for latitude/longitude. You can see all the issues on Github. Good news is all these issues have been resolved. Now Leaflet will handle empty and missing data more gracefully, issuing errors or warnings correctly.

Highlight Shapes

A very common use case when dealing with shapes is to be able to highlight them when the mouse hovers over. This was possible earlier using some ugly hacks, but now you have a very straight forward interface to do just that. Check out my Rpubs: Highlight Polygons example page.

NOTE: This option is not yet available for addGeoJSON and addTopoJSON functions.

Documentation

Leaflet documentation has been updated and we also have detailed example pages that deep dive into leaflet features. To get a feel of how the documentation might look like check out this link.

WARNING: This is unpolished work and the final version will be a lot more polished than this one.

End of Phase 3

This marks the end of Phase 4 in my leaflet development and my contracting gig with RStudio. The last eight weeks were absolutely crazy, and I hope all the long hours I put in will benefit the R GIS community even in little ways. If you like what you see or have comments/questions/critiques don’t hesitate to contact me via Twitter or open an issue over at Github. In the mean time happy mapping.

What Next?

Even if my contracting gig with Rstudio is over, I haven’t quit leaflet development. In fact I am only just getting started, so stay tuned for more developments.