r-spatial / mapedit

Interactive editing of spatial data in R
https://www.r-spatial.org/r/2019/03/31/mapedit_leafpm.html
Other
218 stars 33 forks source link

Load back previously drawn polygons to mapedit map #108

Open cywhale opened 4 years ago

cywhale commented 4 years ago

Hi, I can export drawn objects into sf, or as plain text of geometry, saving it into file, by

  nf <- input[[ns("map_draw_all_features")]]
  drawn_obj <-  <- do.call(rbind,sapply(seq_along(nf$features), function(x) {
    st_sf(id=nf$features[x][[1]]$properties$`_leaflet_id`,
          type=nf$features[x][[1]]$geometry$type,
          geom=sf::st_geometry(mapedit:::st_as_sfc.geo_list(nf$features[x][[1]])),
          crs=st_crs(4326))
  }, simplify=FALSE))

Is there any way to load previously drawn objects into mapedit map back again?