knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(echo = TRUE)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(sf)
## Linking to GEOS 3.6.1, GDAL 2.1.3, PROJ 4.9.3
library(leaflet)
library(readr)
library(janitor)
## 
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
## 
##     chisq.test, fisher.test
library(readxl)
ComunidadVietnamALREVES2 <-read_excel("ComunidadVietnamALREVES.xlsx")
ComuVietclean2 <-ComunidadVietnamALREVES2%>% 
  clean_names()
ComuVietclean2
## # A tibble: 384 x 3
##    informacion_ordenanzas                                       long    lat
##    <chr>                                                       <dbl>  <dbl>
##  1 "Calle #1 Esquina Calle O Parcela VA-002\r\n 2011-2012, … 233624. 2.67e5
##  2 "Calle Las Palmas #10 Parcela VA-009  \r\n2010-2011, 30,… 233691. 2.67e5
##  3 "Avenida Ponce de León # 20 Parcela VB-001\r\n2011-2012,… 233562. 2.67e5
##  4 "Calle Las Palmas Parcela VB-004  \r\n2011-2012, 245, Fi… 233599. 2.67e5
##  5 "Avenida Ponce de León # 132 Parcela VB-008  Propiedad,\… 233559. 2.67e5
##  6 "Avenida Ponce de León Parcela VB-009  \r\n2010-2011, 19… 233563. 2.67e5
##  7 "Ave. Ponce de León #136 Parcela VB-10   \r\n2011-2012, … 233559. 2.67e5
##  8 "Avenida Ponce de Leon # 138 Parcela VB-20  \r\n2011-201… 233542. 2.67e5
##  9 "Calle 1 Parcela VB-14  \r\n2011-2012, 168, 040-092-032-… 233609. 2.67e5
## 10 "Avenida Ponce de León #138 Parcelas VB-019\" y VC-003A … 233550. 2.67e5
## # … with 374 more rows
df.ComVieAR2 <- st_as_sf(ComuVietclean2, coords = c("long", "lat"), crs = 4437)
df.ComVieAR2<-st_transform(x = df.ComVieAR2, crs = 4326)
df.ComVieAR2$long<-st_coordinates(df.ComVieAR2)[,1] # get coordinates
df.ComVieAR2$lat<-st_coordinates(df.ComVieAR2)[,2] # get coordinates
df.ComVieAR2 %>%
  leaflet() %>%
  addTiles() %>%
  addMarkers(~long, ~lat, popup = ~informacion_ordenanzas)
df.ComVieAR2 %>%
  leaflet() %>%
  addTiles() %>%
  addCircleMarkers(~long, ~lat, popup = ~informacion_ordenanzas, stroke = TRUE, color = "#F03", weight =1, opacity = 0.8, fill = TRUE, fillColor = "red")