From the course: Creating Maps with R

Unlock the full course today

Join today to access over 24,200 courses taught by industry experts.

Use Leaflet to visualize geo locations

Use Leaflet to visualize geo locations

From the course: Creating Maps with R

Use Leaflet to visualize geo locations

- Let's use leaflet to visualize geolocation using the script in the 05_02b project. I'm going to run lines 15 through to one. So that's going to load our packages and define our two data sets. And line 17 through 23, I've started our map off, which is going to include just a border for Brazil. Let's start with a geo marker plot. So let's add a pipe at the end of line 23, and we'll type addMarkers. We'll add the data argument, and we will provide brazil_cities. And that adds our locations as teardrop icons that you'll be familiar with from services like Google Maps. There's not much that we can do to customize these maps, so let's swap this geo marker plot for geo scatter plot by changing addMarkers into addCircleMarkers. So these circles both have a fill color and they have a border as well. Let's change the width of the border, which is currently quite wide, by adding the argument, weight is equal to one. Let's…

Contents