MulaiMulai sekarang secara gratis

Adding a Custom Map Tile

Did any tile names look familiar? If you have worked with the mapping software you may recognize the name ESRI or CartoDB.

We create our first leaflet map using the default OSM map tile.

leaflet() %>% 
    addTiles()

We will primarily use CartoDB provider tiles, but feel free to try others, like Esri. To add a custom provider tile to our map we will use the addProviderTiles() function. The first argument to addProviderTiles() is your leaflet map, which allows us to pipe leaflet() output directly into addProviderTiles(). The second argument is provider, which accepts any of the map tiles included in the providers list.

Latihan ini adalah bagian dari kursus

Interactive Maps with leaflet in R

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Change addTiles() to addProviderTiles() and set the provider argument to "CartoDB"
leaflet() %>% 
    addTiles(provider = ___)
Edit dan Jalankan Kode