-
Notifications
You must be signed in to change notification settings - Fork 0
/
DDP_W2_R_leaflet.Rmd
35 lines (29 loc) · 1.04 KB
/
DDP_W2_R_leaflet.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
---
title: "DDP_W2_R_Leaflet_output"
author: "T Sathiyanarayanan"
date: "27 May 2024"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
## My First Leaflet Map
Create a leaflet map object.
```{r cars}
library(leaflet)
map <- leaflet() %>% addTiles()
```
Create a marker with a picture of Benrath Palace and a link to its homepage.
```{r}
benrathPalaceIcon <- makeIcon(
iconUrl = "http://www.schloss-benrath.de/fileadmin/_processed_/csm_corps-de-logis-blumen_2e04b2b859.jpg",
iconWidth = 30*408/255, iconHeight = 30,
iconAnchorX = 30*408/255/2, iconAnchorY = 30/2
)
```
Add the marker to the map and display the map.
```{r}
benrathPalacePopup <- c("<a href= 'http://www.schloss-benrath.de/welcome/?L=1' >Benrath Palace<br><img src='http://www.schloss-benrath.de/fileadmin/_processed_/csm_corps-de-logis-blumen_2e04b2b859.jpg' width='210' height='132' alt='Foto Corps de Logis' title='Foto Corps de Logi'></a>")
map %>%
addTiles() %>%
addMarkers(lat=51.161027, lng=6.870550, popup = benrathPalacePopup)
```