library(leaflet)
mymap<-leaflet() %>%
addTiles()
mymap<- mymap %>%
addMarkers(lat=25.2071038,lng=75.8917735 ,
popup="My location")
mymap
19/07/2020
library(leaflet)
mymap<-leaflet() %>%
addTiles()
mymap<- mymap %>%
addMarkers(lat=25.2071038,lng=75.8917735 ,
popup="My location")
mymap
set.seed(12123213)
x<- runif(1000, min = 25,max=28 )
y<-runif(1000,min = 75, max=78)
df<-data.frame(lat=x,lng=y)
df %>%
leaflet() %>%
addTiles() %>%
addMarkers(clusterOptions = markerClusterOptions())
names<-c("A","B","C","D","E","F")
population<-runif(6,min = 1000000, max = 10000000)
lati<-runif(6,min = 20, max = 30)
longi<-runif(6,min = 72, max = 80)
cities<-data.frame(name=names, pop=population,lat=lati, lng=longi)
cities %>%
leaflet() %>%
addTiles() %>%
addCircles(weight = 10,radius = sqrt(cities$pop)*30)
## Assuming "lng" and "lat" are longitude and latitude, respectively
leaflet() %>%
addTiles() %>%
addRectangles( lat1 = 25, lng1= 75,
lat2 =30,lng2=80 )
## 5th slide
mp<-data.frame(lat=runif(20, min=25.2, max=26),
lng=runif(20, min = 75, max = 75.9),
col = sample(c("Red","Green","Blue"),20,rep=T),
stringsAsFactors = F
)
mp %>%
leaflet() %>%
addTiles() %>%
addCircleMarkers(color = mp$col) %>%
addLegend(labels = LETTERS[1:3],colors = c("Red","Green","Blue"))
## Assuming "lng" and "lat" are longitude and latitude, respectively