Как называть различные файлы geo json блестящими? - PullRequest
0 голосов
/ 11 июля 2020

Я не знаю, как изменить файл, чтобы карта тоже изменилась. Пожалуйста, посмотрите и помогите здесь.

Я пытаюсь вызвать различные географические json файлы в блестящем виде.

Как показано ниже, я использую R для этого:

covid = read_csv("Covid-19.csv")

R1 = geojson_read(
"~/GitHub/chilemapas/data_geojson/comunas/r01.geojson", what = "sp")
R1@data = R1@data %>%   left_join(covid, by = c("codigo_comuna" =
"Codigo comuna"))
 
R2 = geojson_read(
"~/GitHub/chilemapas/data_geojson/comunas/r02.geojson", what = "sp")
R2@data = R2@data %>%   left_join(covid, by = c("codigo_comuna" =
"Codigo comuna"))
 
R3 = geojson_read(
"~/GitHub/chilemapas/data_geojson/comunas/r03.geojson", what = "sp")
R3@data = R3@data %>%   left_join(covid, by = c("codigo_comuna" =
"Codigo comuna"))
 
R4 = geojson_read(
"~/GitHub/chilemapas/data_geojson/comunas/r04.geojson", what ="sp")
R4@data = R4@data %>%   left_join(covid, by = c("codigo_comuna" =
"Codigo comuna"))
 
R5 = geojson_read(
"~/GitHub/chilemapas/data_geojson/comunas/r05.geojson",what = "sp")
R5@data = R5@data %>%   left_join(covid, by = c("codigo_comuna" =
"Codigo comuna"))
 
R6 = geojson_read(
"~/GitHub/chilemapas/data_geojson/comunas/r06.geojson", what = "sp")
R6@data = R6@data %>%   left_join(covid, by = c("codigo_comuna" =
"Codigo comuna"))
 
R7 = geojson_read(
"~/GitHub/chilemapas/data_geojson/comunas/r07.geojson", what = "sp")
R7@data = R7@data %>%   left_join(covid, by = c("codigo_comuna" =
"Codigo comuna"))

R8 = geojson_read(
"~/GitHub/chilemapas/data_geojson/comunas/r08.geojson", what = "sp")
R8@data = R8@data %>%   left_join(covid, by = c("codigo_comuna" =
"Codigo comuna"))
 
R9 = geojson_read(
"~/GitHub/chilemapas/data_geojson/comunas/r09.geojson", what = "sp")
R9@data = R9@data %>%   left_join(covid, by = c("codigo_comuna" =
"Codigo comuna"))
 
R10 = geojson_read(
"~/GitHub/chilemapas/data_geojson/comunas/r10.geojson", what = "sp")
R10@data = R10@data %>%   left_join(covid, by = c("codigo_comuna" =
"Codigo comuna"))
 
R11 = geojson_read(
"~/GitHub/chilemapas/data_geojson/comunas/r11.geojson", what = "sp")
R11@data = R11@data %>%   left_join(covid, by = c("codigo_comuna" =
"Codigo comuna"))

R12 = geojson_read(
"~/GitHub/chilemapas/data_geojson/comunas/r12.geojson", what = "sp")
R12@data = R12@data %>%   left_join(covid, by = c("codigo_comuna" =
"Codigo comuna"))
 
R13 = geojson_read(
"~/GitHub/chilemapas/data_geojson/comunas/r13.geojson",what = "sp")
R13@data = R13@data %>%   left_join(covid, by = c("codigo_comuna" =
"Codigo comuna"))

R14 = geojson_read(
"~/GitHub/chilemapas/data_geojson/comunas/r14.geojson", what ="sp")
R14@data = R14@data %>%   left_join(covid, by = c("codigo_comuna" =
"Codigo comuna"))
 
R15 = geojson_read(
"~/GitHub/chilemapas/data_geojson/comunas/r15.geojson", what = "sp")
R15@data = R15@data %>%   left_join(covid, by = c("codigo_comuna" =
"Codigo comuna"))
 
R16 = geojson_read(
"~/GitHub/chilemapas/data_geojson/comunas/r16.geojson", what = "sp")
R16@data = R16@data %>%   left_join(covid, by = c("codigo_comuna" =
"Codigo comuna"))  

Casos Acumulados

### Filtros

selectInput("codigo_region", label = "Region",
            choices = c("01","02","03","04","05","06","07","08","09","10","11","12",
                        "13","14","15","16"))
 
 selector = reactive({   DT = switch(input$codigo_region,
               "01" = sp("~/GitHub/chilemapas/data_geojson/comunas/r01.geojson"),
               "02" = fread("~/GitHub/chilemapas/data_geojson/comunas/r02.geojson")
              ) })



Column {data-width=550}
--------------------------------------------------

### Mapa Interactivo

renderLeaflet({
      selector() %>% leaflet() %>% addTiles()%>% addPolygons() })

Заранее спасибо.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...