0

I need some help to complete the following code to display choropleth interactive map by clicking on a button.

# Plotting the shapefile
observeEvent(input$shape, {
  p1=leafletProxy("gridmap") %>% clearShapes() %>% clearMarkers() %>% removeLayersControl() %>% 
    clearMarkers() %>% clearPopups() %>% clearControls() %>%  addTiles() %>% addProviderTiles(providers$OpenStreetMap) %>%
    setView(lat=as.numeric(centralPointReac()[1]),
            lng=as.numeric(centralPointReac()[2]),
            zoom=13)
  states <- geojsonio::geojson_read("123.geojson", what = "sp")
  leaflet() %>% addTiles() %>% addProviderTiles(providers$OpenStreetMap) %>%   
    addPolygons(data = states, fill = FALSE, stroke = TRUE, color = "#03F")

})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.