Polygons are meant to cover regions in my map and are supposed to return summary statistics for the given regions when clicked. In these cases, consider using rmapshaper::ms_simplify, which does topology-preserving simplification conveniently from R. Circles are added using addCircles(). Markers stand for individual venues and should return summary statistics for the given venue. Adding some color. leaflet is an R package that makes it easy for R coders to create Leaflet JavaScript maps. Explaining predictions of Convolutional Neural Networks with 'sauron' package. Zoomed region of Leaflet map, showing hover label (this is a static screenshot of an interactive map). You can drag to pan, scroll to zoom, click to show popups, etc. The benefit of creating a JavaScript map over a .jpg map as we did in our last post is that the map is “slippy,” that is, it slips around inside its container. As such, leaflet is not a good choice for pasting images in papers and presentations, or for setting a snazzy new desktop background. R/layers.R defines the following functions: zoomAnimationWarning removeLayersControl layersControlOptions addLayersControl clearGeoJSON removeGeoJSON addGeoJSON clearShapes removeShape addPolygons addRectangles addPolylines addCircles highlightOptions pathOptions removeMarkerFromCluster clearMarkerClusters removeMarkerCluster clearMarkers removeMarker … Highlighting shapes. What leaflet might lose in creating annotations and allowing for extremely precise aesthetic changes, it gains by allowing for paning, zooming, hovers, and popups. string specifying the column of data containing the encoded polyline. Copyright © 2021 | MH Corporate basic by MH Themes, https://phl.carto.com/api/v2/sql?q=%0A%20%20select%20%2A%0A%20%20from%20shootings%0A%20%20where%20year%20%3E%202018%0A&format=GeoJSON, Click here if you're looking to post or find an R/data-science job, PCA vs Autoencoders for Dimensionality Reduction, Machine Learning with R: A Complete Guide to Logistic Regression. Basic Leaflet choropleth (this is a static screenshot of an interactive map). These have very different ranges, so a shared legend is not feasible. Here is a quick translation for those unfamiliar with html: and mean to start and end a section of bold text, and mean to start and end a section of italics, and means to add a line break. Next, we will do some basic data cleaning. addPolygons) and supply the … leaflet에서 점을 찍을 때는 addCircles()라는 함수를 쓰시면 됩니다. This is a sobering dataset that allows city residents to see location information for shootings, basic demographic information about shooting victims, and trend the city’s gun violence over time. Very interestingly, addPolygons() does work when I first use dplyr::slice() to slice all the rows of the sf dataframe. The options available to us are a little bit different. 6 leaflet. The Leaflet JavaScript library is © 2010–2016 Vladimir Agafonkin, 2010–2011 CloudMade. Choropleths–maps in which each region is colored according to a summary statistic–are a powerful way to visualize data. The first dataset is a .geojson file containing geospatial descriptions of Philadelphia’s neighborhoods, courtesy of OpenDataPhilly. It takes lng1, lng2, lat1, and lat2 vector arguments that define the corners of the rectangles. You can pipe the shp data directly into our calls to leaflet(), addTiles(), and addPolygons() without supplying any additional arguments to map North Carolina's zip codes. ... (con addTiles), el mapa vectorial como un polígono (addPolygons) y una leyenda (addLegend). Leaflet R background color. Source: OpenDataPhilly. The leaflet package makes it easy to add map tiles, or “basemaps” to the layperson. By giving the user the ability to zoom into the polygon, once a polygon is clicked, it makes it a lot easier to focus in on a particular area of the map. There are 5 potential column names: lat, latitude, lng, long, longitude. leaflet is an open-source JavaScript library that is used to create dynamic online maps. A boundary thickness of 1 pixel, Polygons that are colored with the nc_pal palette and are highlighted on hover, and; Labels that display the words "Mean Income:" followed by the mean income of the zip code. To get you started, the shp SpatialPolygonsDataFrame including the IRS income variables has been loaded for you. I also found it necessary to add a small stroke to the polygons in order to completely remove the sliver gaps from the example map. GooglyPlusPlus2021 interactively ranks T20 batsmen and bowlers!!! Polygons are separated by rows of. addControl: Add arbitrary HTML controls to the map. Calling addPolygons on the map widget will know to add the polygons from that SpatialPolygonsDataFrame. Get ready to have some fun with maps! It works efficiently across all major desktop and mobile platforms, can be extended with lots of plugins, has a beautiful, easy to use and well-documented API and a simple, readable source code that is a joy to contribute to.”. Circles are similar to circle markers; the only difference is that circles have their radii specified in meters, while circle markers are specified in pixels. Arguments map. Adding polygons to a leaflet map derived from an sf object currently fails (i.e., the polygons are not shown) in case the geometry column of the object has names. The ultimate goal is to have the different layers for the different chemicals selectable and show the respective legend. Zoomed region of Leaflet map, with jittered points (this is a static screenshot of an interactive map). The leaflet approach to plotting graphs can be somewhat tricky at first, as there are a lot of parameters that you can choose to adjust. But before that, the r e al king of data was arguably politics, so here I will pay fealty to the former ruler of data visualisation and give you a step-by-step of how to build an interactive choropleth map to display election results using R Studio and the Leaflet library. As soon as I add this (without any shiny elements - … Basic map of Philadelphia gun violence (ggplot2). Normally, you create a Leaflet map using the leaflet function. An important part of spatial visualization is mapping variables to colors. mapdata装的就是我选择的国家数据,其中bbox数据用来告诉leaflet我要fly到哪个矩形坐标框:flyToBounds(rgn[1], rgn[2], rgn[3], rgn[4]);而addPolygons方法会将mapdata中的polygons多边形坐标数据读出,并填充颜色和描边; 至此一个飞行地图出炉啦,是不是很简单? YouTube Channel Update: Coffee Ratings Analysis now up! In this final map, we add back our provider tiles, our label, and our highlight options, with no changes here from what had been done earlier in this post. I can’t speak to how joyous contributing to their source code is (especially since I know no JavaScript), but I can attest that Leaflet’s documentation–including their documentation of their R package–is clear and comprehensive. In this course, you will create maps using the IPEDS dataset, which … Doing so in R is alluringly easy with Leaflet. addWMSTiles: Add a WMS tile layer to the map. As in our last post, we will add the data in each layer, since we are working with two distinct datasets. Here’s a basic example: Source: OpenDataPhilly, Final Leaflet map, showing popup (this is a static screenshot of an interactive map). The concepts of loading and mapping various layers of data in leaflet are similar to what we had seen in ggplot2. ), run the code chunks or download the R code in its entirety. Create a map widget by calling leaflet() Add layers to the map using one or more of the layer functions (e.g. 6 leaflet. Let’s dig in! Try clicking it here, and you will see your browser download a file for you, In R, we use `httr::modify_url()` to create our URL and `sf::read_sf()` to download the .geojson file and load it into R as a simple features object. The package documentation is good, but as the interactive visualization is usually the last step of a complex process I felt the need to share some of my lessons learned. The resulting map is quite disapointing: China and India having very numerous population, all the variation between other countries gets hard to observe on the map. If we want to run non-geospatial analysis on our shootings data, such as plotting shootings over time, calculating totals by demographic, and so on, we can drop the geospatial information and work with a standard tibble using sf::st_drop_geometry(shootings). When plotting both, only Polygons display the hover info … Note from above that both of the datasets are already in the WGS 84 CRS. Bonjour à tous, je tente de réaliser de simple carte avec shiny et la fonction leaflet pour ensuite les insérer dans un dashboard The second dataset is geospatial point data, also provided by OpenDataPhilly, that contains information from the police department on shooting victims. I have a choropleth style leaflet map which works fine in Rmarkdown as long as it does not have shiny runtime. Adding polygons to a leaflet map is a very common thing to do in leaflet.This can be achieved by using the addPolygons() function. Read in data using sf and raster packages. Details. You can use highlightOptions with all of the shape layers described on this page. For those unfamiliar with this type of API, here is a brief introduction. Multiple shootings on the same block result in overlapping points. Use the addPopups () function to add standalone popup to the map. addpolygons - r leaflet legend Rのためのリーフレットを入手する方法シャイニングダッシュボードの高さの100%を使用する (3) group name of a leaflet layer group. addTiles(), addMarkers(), addPolygons()) Repeat step 2 as many times as necessary to incorporate the necessary information; Display the map widget; A basic example is: Then use one of leaflet‘s options such as colorBin(), colorFactor(), colorNumeric() or colorQuantile() to appropriately assignin the color palette to your range of data. Tip #2: Have map zoom into polygon once polygon is clicked in shiny. Supplying this value will tie the legend to the leaflet layer group with this name and will auto add/remove the legend as the group is added/removed, for example via layerControl. We are excited to announce that a new package leaflet has been released on CRAN. The syntax is identical to the mapdeck syntax. 今天要讲的是Leaflet for R 这样一个神奇的包。 LeafletR主要是用R语言的语法封装了JS版的Leaflet,可以在R语言的plot窗口,利用html5技术显示各种地图,还可以绘制自己的要素图形。 它有如下功能: 交互地图浏览(缩放、平移) 使用多种底图进行任意组合 leaflet requires that data be in WGS 84, so we would need to convert to WGS 84 (EPSG code: 4326) using sf::st_transform(shootings, crs = 4326) if it weren’t provided to us with that CRS. But before that, the r e al king of data was arguably politics, so here I will pay fealty to the former ruler of data visualisation and give you a step-by-step of how to build an interactive choropleth map to display election results using R Studio and the Leaflet library. Add layers (i.e., features) to the map by using layer functions (e.g. It seems that the solution lies in setting the smoothFactor argument in AddPolygons to 0, as suggested in this related post: Leaflet geojson styling leaves gaps between polygon. This is part 3 of a 4-part series on how to build maps using R. How to load geospatial data into your workspace and prepare it for visualization, How to make interactive maps (pan, zoom, click) using leaflet, How to add interactive maps to a Shiny dashboard. This should look very similar to what we would have written for ggplot2! Spatial objects (points, lines, polygons, rasters) in your R environment can also be added as map layers, provided that they have a CRS defined with a datum. First the function leaflet() is called, followed by … But, that is to be expected. To interact with the map (as it was intended! We have also added a legend (and assigned the palette function to it), which describes the color range. 線條與形狀. We would struggle to recreate and exact copy of ggplot2‘s maps in leaflet. Why Leaflet over other options? I'm creating a Shiny App using a leaflet widget. With some creative combinations of these html tools, we can create a simple and effective popup box. Source: OpenDataPhilly. You will need to set the group when you add a layer (e.g. Or, download the R code used in this post and run it yourself! This creates an in-memory representation of a map that you can customize using functions like addPolygons and setView.Such a map can be printed at the R console, included in an R Markdown document, or rendered as … Pick a color palette from a RColorBrewer or viridis, or build your own. When plotting circles, only the circle centers (and radii) are required, so the set of valid data sources is different than for polygons and the same as for markers. Our favorite is CartoDB.Voyager, but you can explore the entire set of options and pick your favorite. addTiles(), addMarkers(), addPolygons()) Repeat step 2 as many times as necessary to incorporate the necessary information; Display the map widget; A basic example is: Leaflet maps are built using layers, similar to ggplot2. Source: OpenDataPhilly. We zoomed in on the map before taking a screenshot so that you can see the points in more detail. data. Think carefully about when to use each one so that you can display data clearly, insightfully, and intuitively. The syntax is identical to the mapdeck syntax. You can either choose to call addTiles() with no arguments to get the default basemap from OpenStreetMap or choose to call addProviderTiles() to get one of the various third-party options. Simple, right? You can either choose to call addTiles() with no arguments to get the default basemap from OpenStreetMap or choose to call addProviderTiles() to get one of the various third-party options. I've tried updating the package to the most recent CRAN and development versions but no luck. We add two new variables to our shootings dataset: a “color” variable that encodes encodes the “fatal” variable into red and grey, and a “popup” variable that summarizes key information about each shooting. Why Gradient Descent Works (and How To Animate 3D-Functions in R). Supplying this value will tie the legend to the leaflet layer group with this name and will auto add/remove the legend as the group is added/removed, for example via layerControl. 2. Here's my approach for making a more generalized heat map in Leaflet using R. This approach uses contourLines, like the previously mentioned blog post, but I use lapply to iterate over all the results and convert them to general polygons. It is now possible to draw a first choropleth map.Here are the main steps to follow: create a color palette thanks to the colorNumeric() function; make the background map with leaflet(), addTiles() and setView(); use addPolygons() to add the shape of all country, with a color representing the number of people in the country. 参考. Leaflet recommends escaping HTML text for security reasons in situations where labels and popups might contain unwanted HTML content. Hi, I am wondering whether is possible to have both clickable Markers as well as Polygons in one leaflet map? See the introduction to Markers for specifics. Here's a tutorial on using Leaflet in R. While the leaflet package supports many options, the documentation is not the clearest and I had to do a bit of googling to customise the plot to my liking. A closer look on addTile() and addLayersControl() Conclusion Introduction Leaflet lets you create interactive maps right from the R console. Basic map of Philadelphia gun violence (leaflet; this is a static screenshot of an interactive map). Change background tile with leaflet and R – the R Graph Gallery, This post shows how to change the background tile used by the leaflet R package. Two-column numeric matrix; the first column is longitude and the second is latitude. addPolygons() - instead of dots, we’re adding Polygons, or shapes ... We’ll also use a leaflet function called colorNumeric() that will turn the continuous variable of numbers of stores into a categorical variable by dividing it into bins and assigning it a hue of color we want. I try to plot a map of concentrations of chemicals. These arguments are always required; the rectangle geometry cannot be inferred from the data object. In this instance: Greens. I try to plot a map of concentrations of chemicals. Posted on January 12, 2021 by Nathaniel Schmucker in R bloggers | 0 Comments. We can do so by using the colorNumeric() function which is part of the R leaflet package. Basic map of Philadelphia gun violence (ggplot2). Its use is simple: The user creates a map widget and then layers features onto that map widget until the display and interactivity are as desired. (We used this data in our last post, too.). rawleafletmap <-leaflet %>% addProviderTiles ("CartoDB.Positron", options = tileOptions (minZoom = 10, maxZoom = 13)) The addPolygons function overlay the base map with our desired shapefile. Thanks for considering this. Leaflet for R Leaflet for R is developed by the guys who brought us RStudio. To use the API, we need to ping to a particular URL. This dataset is accessed through an call to an API. The leaflet package makes it easy to add map tiles, or “basemaps” to the layperson. The above example uses the highlightOptions parameter to emphasize the currently moused-over polygon. You will need to set the group when you add a layer (e.g. Adding the color and popup variables to our plot is as simple as specifing color = ~color and popup = ~popup inside our addCircles() function call. Add a basemap. Leaflet is an open-source JavaScript library for making interactive maps. Final Leaflet choropleth, showing hover text and region highlight (this is a static screenshot of an interactive map). In this post, we will learn how to make interactive maps using the leaflet package. It provides an overview of the most common tiles with their associated code. The warning conditions would be … Notice that we need to add htmltools::htmlEscape(). In this example, let us suppost that we would like to show the total number of shootings in each neighborhood. ... and the addPolygons() function. This walkthrough documents the key features of the package which … A closer look on addTile() and addLayersControl() Conclusion Introduction Leaflet lets you create interactive maps right from the R console. This posts focuses on leaflet plots, but at some point I’ll also use a shapefile and plot this on the leaflet map. The ultimate goal is to have the different layers for the different chemicals selectable and show the respective legend. polyline. In the example below, we picked a palette ranging from Yellow to Red and assigned it to the “total_shootings” variable. large) shape data can present a problem for Leafet, since it is all eventually passed into the browser and rendered as SVG, which is very expressive and convenient but has scalability limits. Like static plotting and mapping, there lots of options for interactive mapping in R. The leaflet package is actively maintained by RStudio. addPolygons() - instead of dots, we’re adding Polygons, or shapes ... We’ll also use a leaflet function called colorNumeric() that will turn the continuous variable of numbers of stores into a categorical variable by dividing it into bins and assigning it a … You may have seen that some of the points in the plot above were darker than others. First Steps 1.2 Adding Data 1.2.1 Example 1.4 Useful commands from other spatial R packages 3. lat Very detailed (i.e. Print the map widget to display it. A common use for popups is to have them appear when markers or shapes are clicked. Now, let’s color the states according to their population density. If Null, the data passed into google_map() will be used. You do not need vast sql knowledge here. The basemap helps with the visual aesthetic, but we still have a long way to go. Polygons are meant to cover regions in my map and are supposed to return summary statistics for the given regions when clicked. The "leaflet" R package is copyright © 2014-2016 RStudio, Inc. Leaflet map with provider tiles (this is a static screenshot of an interactive map). make the background map with leaflet(), addTiles() and setView() use addPolygons() to add the shape of all country, with a color representing the number of people in the country. Colors. This is a six-step process: The final step–the creation of a palette function–is somewhat unique to leaflet. Our popup variable contains html. addTiles, addMarkers, addPolygons) to modify the map widget. The downside, however, is that, since leaflet creates a JavaScript map, the map can only be shared in an interactive environment like a web browser. Doing so in R is alluringly easy with Leaflet. To avoid this issue, we will “jitter” our points, adding a small amount of random displacement in the x- and y-directions. In the end though, it’s relatively similar to ggplot2 in that we create a base object, add layers to it, and adjust each layer’s parameters as we add it. Go back to Maps, Part 2 for that. [RESOLU] leaflet addpolygons problème de visualisation. Rでウェブ解析:コロプレスを簡単にプロット!「choroplethr」パッケージ. One important note: This post does not embed actual Leaflet maps. addPolygons() no longer seems to render any polygons when I input sf dataframes. Line and polygon data can come from a variety of sources: The above example uses the highlightOptions parameter to emphasize the currently moused-over polygon. I’ts actually a JavaScript library available as a package in R. There’s a great integration with R Shiny, but I’m not going to talk about that. The only difference in code is that we have to specify if we want to add Polygons or Circles, and we replace the + with %>%. For the neighborhoods dataset, we will drop and rename columns. Interactive Maps with leaflet in R will give you the tools to make attractive and interactive web maps using spatial data and the tidyverse. Markers stand for individual venues and should return summary statistics for the given venue. Source: OpenDataPhilly. Our final set of aesthetic changes will be to our point layer. To make this jitter consistent each time you render the plot, remember to set the seed value for the random jitter using set.seed(). (The bringToFront = TRUE argument is necessary to prevent the thicker, white border of the active polygon from being hidden behind the borders of other polygons that happen to be higher in the z-order.) Adding polygons to a leaflet map is a very common thing to do in leaflet.This can be achieved by using the addPolygons() function. You have the option of loading data either as the data = ... argument in leaflet::leaflet() or waiting until subsequent layers to provide the data. Interactive maps are a powerful visualization tool, and the javascript library leaflet.js is a great means to achieving this objective. To quote from Leaflet’s website, “Leaflet is the leading open-source JavaScript library for mobile-friendly interactive maps…Leaflet is designed with simplicity, performance and usability in mind. highlightOptions: Options to highlight a shape on hover Repeat step 2 as desired. These three reasons–the power of the underlying JS library, the comprehensive R documentation, and the familiar R framework–make leaflet an obvious choice for the R data analyst. data frame containing at least a polyline column, or a lat and a lon column. Create a map widget by calling leaflet() Add layers to the map using one or more of the layer functions (e.g. I will try this on RStudio Version 0.99.484. You create a Leaflet map with these basic steps: Create a map widget by calling leaflet (). Upcoming Why R Webinar – Why using R for analysis of the human microbiome is a good idea, Little useless-useful R functions – Countdown number puzzle, Junior Data Scientist / Quantitative economist, Data Scientist – CGIAR Excellence in Agronomy (Ref No: DDG-R4D/DS/1/CG/EA/06/20), Data Analytics Auditor, Future of Audit Lead @ London or Newcastle, python-bloggers.com (python/data-science news), How to Make Synthetic Datasets with Python: A Complete Guide for Machine Learning, Beginners Guide: Predict the Stock Market, How To Unlock The Power Of Datetime In Pandas, Precision-Recall Curves: How to Easily Evaluate Machine Learning Models in No Time, Predicting Home Price Trends Based on Economic Factors (With Python), Click here to close (This popup will not appear again), (Optional) Filter based on the summary statistics. This is a numeric vector that defines the boundaries between intervals ((0,10], (10,20], and so on). Notice that we can change the opacity and location of the legend so that it is as unobtrusive as possible. These have very different ranges, so a shared legend is not feasible. The R package leaflet is an interface to the JavaScript library Leaflet to create interactive web maps. addCircleMarkers: Add circle markers to the map. We’ll also add a label, which will appear upon hover. addPolygons) and supply the … Below each piece of code you will find a static image of the map. Marker and shape functions in the Leaflet package take a popup argument, where you can pass in HTML to easily attach a simple popup. In the previous example it's up to the user to individually plot each polygon, so I would call this "more generalized" (at least this is the generalization … Leaflet will try to make the necessary trasnformation to display your data in EPSG:3857. Some other packages for interactive maps that build off of leaflet, or other interactive plotting libraries, are: tmap, ggiraph, rbokeh, plotly, highcharter, mapedit, mapview, leaflet.extras, and leaflet.esri. Zoomed region of final Leaflet map, showing popup (this is a static screenshot of an interactive map). addTiles: Add a tile layer to the map. More than 3 years have passed since last update. In the shootings dataset, we will remove points that have latitude and longitude in Florida. My map has a simple Shapefile with no basemap engaged. In this course, you will create maps using the IPEDS dataset, which contains data on U.S. colleges and universities. The identically named R package makes it possible to create these kinds of maps in R as well. Leaflet maps are built using layers, similar to ggplot2. Leaflet is a great way of showing maps. As a result, circles are scaled with the map as the user zooms in and out, while circle markers remain a constant size on the screen regardless of zoom level. Source: OpenDataPhilly. Leaflet for R - The Map Widget, The data argument is used to derive spatial data for functions that need it; for example, if data is a SpatialPolygonsDataFrame object, then calling addPolygons Draw a polygon on an existing xts plot by specifying a time series of y coordinates. Installation Installation works “flawlessly” by typing install.packages("leaflet") into the R console. leaflet is an open-source JavaScript library that is used to create dynamic online maps. Here's my approach for making a more generalized heat map in Leaflet using R. This approach uses contourLines, like the previously mentioned blog post, but I use lapply to iterate over all the results and convert them to general polygons. It was developed on top of the htmlwidgets framework, which means the maps can be rendered in R Markdown (v2) documents, Shiny apps, and RStudio IDE / the R console. Tip #2: Have map zoom into polygon once polygon is clicked in shiny. Hi, I am wondering whether is possible to have both clickable Markers as well as Polygons in one leaflet map? https://stackoverflow.com/.../r-leaflet-addpolygons-by-group When plotting both, only Polygons display the hover info … Think of these two packages as complimentary tools in your analytics arsenal. Interactive Maps with leaflet in R will give you the tools to make attractive and interactive web maps using spatial data and the tidyverse. Rectangles are added using the addRectangles() function. Its use is simple: The user creates a map widget and then layers features onto that map widget until the display and interactivity are as desired. This popup variable will appear in our map when we click on a point. In leaflet, labels appear upon hover, and popups appear upon click. Use the arguments of addPolygons() to map the high income zip codes in NC with: . The identically named R package makes it possible to create these kinds of maps in R as well. You have various options for mapping data to colors; for this example we’ll match the Leaflet.js tutorial by mapping a specific set of bins into RColorBrewer colors.. First, we’ll define the bins. This is because we had overlapped multiple translucent circles. Leaflet makes it easy to take spatial lines and shapes from R and add them to maps. R leaflet GIS Shiny. Head over to the Leaflet website if you would like to experiment with Leaflet maps yourself. Maps © OpenStreetMap contributors unless otherwise noted. Source: OpenDataPhilly. Contents Introduction 1. 9 to Finale – The Final – Data and Drama in R, ppsr: An R implementation of the Predictive Power Score, Visualizing geospatial data in R—Part 3: Making interactive maps with leaflet. In order to fill the shapes with the desired colours, we need to pass a vector containing the colour hex codes to the fillColor argument of the function. This dataset is polygon data and will form our basemap for layering on additional, more interesting, features. Source: OpenDataPhilly. addLabelOnlyMarkers: Add Label only markers to the map. How to Analyze Data with R: A Complete Beginner Guide to dplyr, My predictions for 2021 – Data and analytics, The creation of ADAM – next step in statistical forecasting, RStudio: A Single Home for R and Python Data Science, Code for the “Variable Utility is not Intrinsic” Article, The Bachelorette Eps. 보시는 것처럼 이 자료에는 각 지점 경도(long) 위도(lat)가 들어 있기 때문에 이 자료를 가져가다 점을 찍으라고 명령을 내리면 됩니다. First the function leaflet() is … The API in response, will send us a file to download. Source: OpenDataPhilly. timelyportfolio added a commit to timelyportfolio/leaflet that referenced this issue May 6, 2016 add `popupOptions` to layers and markers; see rstudio#258 53c8777