leaflet.extras
leaflet.extras copied to clipboard
Function to convert feature collection in list to geojson
I am using addDrawToolbar to draw polygons on my leaflet("map"), and then I want to capture them (ideally to sf) using input$map_draw_all_features
.
However it seems the returned list is not compatible with geojson_list. Am I doing something wrong or is this a "feature request"?
Thanks so much for this excellent tool(bar).
data <- input$map_draw_all_features # list
data <- geojson_list(data)
data <- geojson_sf(data)
This seems to work? I'll test it more.
data <- input$map_draw_all_features # list
data <- jsonlite::toJSON(data, auto_unbox = TRUE) # string
data <- geojsonio::geojson_sf(data) # sf