diff --git a/.Rbuildignore b/.Rbuildignore index f7ba9db..7e8f171 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -3,3 +3,5 @@ ^README\.Rmd$ ^README-.*\.png$ ^CONDUCT\.md$ +^experiments +^cran-comments\.md$ diff --git a/README.Rmd b/README.Rmd index 7736765..a189256 100644 --- a/README.Rmd +++ b/README.Rmd @@ -20,7 +20,7 @@ Interactive editing of spatial data in R | an [RConsortium](https://www.r-consor ### Status -`mapedit` is in a very alpha state right now. We would very much appreciate feedback, ideas, and use cases. The API is very likely to change dramatically and rapidly over the next couple of months. We will use semantic versioning to track changes and progress. +`mapedit` is still in active development. We would very much appreciate feedback, ideas, and use cases. The API has stabilized, but please be aware that the API might change over the next couple of months. We will use semantic versioning with Github tagged releases to track changes and progress. All changes will also be documented in NEWS.md. ### Blog Posts @@ -32,13 +32,12 @@ Interactive editing of spatial data in R | an [RConsortium](https://www.r-consor ### Install -As the CRAN badge above indicates, `mapedit` is a long way from CRAN. To install, please use `devtools`. `mapedit` requires `leaflet.extras` which is not currently on CRAN. We will also need the development version of `mapview`. +As the CRAN badge above indicates, `mapedit` has achieved CRAN status. To install, please use `install.packages`, or for the cutting edge, use `devtools::install_github`. ``` -devtools::install_github("bhaskarvk/leaflet") -devtools::install_github("bhaskarvk/leaflet.extras") -devtools::install_github("r-spatial/mapview@develop") -devtools::install_github("r-spatial/mapedit") +install.packages("mapedit") +# cutting edge +# devtools::install_github(r-spatial/mapedit") ``` ### Examples diff --git a/README.md b/README.md index aaf9c7f..e447b8a 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Interactive editing of spatial data in R | an [RConsortium](https://www.r-consor ### Status -`mapedit` is in a very alpha state right now. We would very much appreciate feedback, ideas, and use cases. The API is very likely to change dramatically and rapidly over the next couple of months. We will use semantic versioning to track changes and progress. +`mapedit` is still in active development. We would very much appreciate feedback, ideas, and use cases. The API has stabilized, but please be aware that the API might change over the next couple of months. We will use semantic versioning with Github tagged releases to track changes and progress. All changes will also be documented in NEWS.md. ### Blog Posts @@ -21,12 +21,11 @@ Interactive editing of spatial data in R | an [RConsortium](https://www.r-consor ### Install -As the CRAN badge above indicates, `mapedit` is a long way from CRAN. To install, please use `devtools`. `mapedit` requires `leaflet.extras` which is not currently on CRAN. We will also need the development version of `mapview`. +As the CRAN badge above indicates, `mapedit` has achieved CRAN status. To install, please use `install.packages`, or for the cutting edge, use `devtools::install_github`. - devtools::install_github("bhaskarvk/leaflet") - devtools::install_github("bhaskarvk/leaflet.extras") - devtools::install_github("r-spatial/mapview@develop") - devtools::install_github("r-spatial/mapedit") + install.packages("mapedit") + # cutting edge + # devtools::install_github(r-spatial/mapedit") ### Examples diff --git a/cran-comments.md b/cran-comments.md new file mode 100644 index 0000000..e07bbb2 --- /dev/null +++ b/cran-comments.md @@ -0,0 +1,16 @@ +## Test environments +* local OS X install, R 3.4.0 +* ubuntu 12.04 (on travis-ci), R 3.4.0 +* win-builder (devel and release) +* rhub::check_for_cran() + +## R CMD check results + +0 errors | 0 warnings | 1 note + +* This is a new release. + +## Reverse dependencies + +This is a new release, so there are no reverse dependencies. + diff --git a/inst/experiments/crosstalk.R b/experiments/crosstalk.R similarity index 100% rename from inst/experiments/crosstalk.R rename to experiments/crosstalk.R diff --git a/inst/experiments/crosstalk_shiny.R b/experiments/crosstalk_shiny.R similarity index 100% rename from inst/experiments/crosstalk_shiny.R rename to experiments/crosstalk_shiny.R diff --git a/inst/experiments/draw_shiny_deleted.R b/experiments/draw_shiny_deleted.R similarity index 100% rename from inst/experiments/draw_shiny_deleted.R rename to experiments/draw_shiny_deleted.R diff --git a/inst/experiments/edit_map_draw_border.R b/experiments/edit_map_draw_border.R similarity index 100% rename from inst/experiments/edit_map_draw_border.R rename to experiments/edit_map_draw_border.R diff --git a/inst/experiments/edit_map_return_sf_tests.R b/experiments/edit_map_return_sf_tests.R similarity index 100% rename from inst/experiments/edit_map_return_sf_tests.R rename to experiments/edit_map_return_sf_tests.R diff --git a/inst/experiments/experiment_split.R b/experiments/experiment_split.R similarity index 100% rename from inst/experiments/experiment_split.R rename to experiments/experiment_split.R diff --git a/experiments/flubber_playback.R b/experiments/flubber_playback.R new file mode 100644 index 0000000..865db6d --- /dev/null +++ b/experiments/flubber_playback.R @@ -0,0 +1,147 @@ +library(sf) +library(mapview) +library(mapedit) +library(geojsonio) +library(htmltools) + +#ed <- editMap() +#rec <- attr(ed, "recorder") + +#bbox <- unclass( +# st_bbox( +# mapedit:::combine_list_of_sf( +# lapply(rec,function(x){x$feature}) +# ) +# ) +#) + +bbox_rect <- geojson_json( + st_polygon( + list(matrix( + c( + c(bbox[1], bbox[4]), + c(bbox[3], bbox[4]), + c(bbox[3], bbox[2]), + c(bbox[1], bbox[2]), + c(bbox[1], bbox[4]) + ), + ncol=2, + byrow=TRUE + )) + ) +) + +tl <- tagList( + tags$head(tags$script(src="https://unpkg.com/flubber")), + d3r::d3_dep_v4(offline = FALSE), + tags$script(HTML( +sprintf( +" +var feat = %s; +var bbox = %s; +var feat_lookup = {}; + +var proj = d3.geoMercator().fitSize( + [800,400], + bbox +); +var path = d3.geoPath().projection(proj); + +var svg = d3.select('body').append('svg') + .style('height', 400) + .style('width', 800) + .classed('map', true); + + +function draw(ed, delay) { + var path_f = svg + .append('path') + .datum(ed) + .style('fill', 'none') + .style('stroke', 'black') + .style('opacity', 0.0001) + .transition(2000) + .delay(delay * 1000) + .style('opacity', 1) + .attr('d', path(ed.feature)); + feat_lookup[ed.feature.features[0].properties.X_leaflet_id] = { + pathd : path(ed.feature), + pathsvg: path_f.node(0) + } +}; + +function edit(ed, delay) { + var path_f = feat_lookup[ed.feature.features[0].properties.X_leaflet_id]; + var interpolator = flubber.interpolate( + path_f.pathd, + path(ed.feature) + ); + + d3.select(path_f.pathsvg) + .transition(2000) + .delay(delay * 1000) + .attrTween('d', function(d) {return interpolator}); +}; + +function del(ed, delay) { + var path_f = feat_lookup[ed.feature.features[0].properties.X_leaflet_id]; + d3.select(path_f.pathsvg) + .transition(2000) + .delay(delay * 1000) + .style('opacity', 0.0001) + .remove(); +}; + +var actions = { + 'map_draw_new_feature' : draw, + 'map_draw_edited_features': edit, + 'map_draw_deleted_features': del +}; + +feat.forEach(function(ed, i) { + actions[ed.evt](ed, i) +}); +/* +var fpath = svg.append('g') + .selectAll('path') + .data([feat[0]]) + .enter() + .append('path') + .attr('d', path) + .style('stroke', 'black') + .style('fill', 'none') + .style('pointer-events', 'all'); + +feat.slice(1).reduce( +function(left,right,i) { +var interpolator = flubber.interpolate( +path(feat[i]), +path(right) +); + +return left +.transition() +.duration(2000) +.attrTween('d', function(d) {return interpolator}); +}, +fpath +); +*/ +", +jsonlite::toJSON( + Map( + function(x){ + x$feature <-geojson_list(x$feature); + x + }, + rec + ), + auto_unbox=TRUE, + force=TRUE +), +bbox_rect + ) + )) + ) + +browsable(tl) diff --git a/experiments/flubber_playback.RData b/experiments/flubber_playback.RData new file mode 100644 index 0000000..7dfcbba Binary files /dev/null and b/experiments/flubber_playback.RData differ diff --git a/inst/experiments/gadget_draw2.R b/experiments/gadget_draw2.R similarity index 100% rename from inst/experiments/gadget_draw2.R rename to experiments/gadget_draw2.R diff --git a/inst/experiments/igraph_mapedit.r b/experiments/igraph_mapedit.r similarity index 100% rename from inst/experiments/igraph_mapedit.r rename to experiments/igraph_mapedit.r diff --git a/inst/experiments/mapedit_attribute_poc.R b/experiments/mapedit_attribute_poc.R similarity index 100% rename from inst/experiments/mapedit_attribute_poc.R rename to experiments/mapedit_attribute_poc.R diff --git a/inst/experiments/merge_tests.R b/experiments/merge_tests.R similarity index 100% rename from inst/experiments/merge_tests.R rename to experiments/merge_tests.R diff --git a/inst/experiments/randgeo_edit.R b/experiments/randgeo_edit.R similarity index 100% rename from inst/experiments/randgeo_edit.R rename to experiments/randgeo_edit.R diff --git a/inst/experiments/select_shiny_crosstalk.R b/experiments/select_shiny_crosstalk.R similarity index 100% rename from inst/experiments/select_shiny_crosstalk.R rename to experiments/select_shiny_crosstalk.R diff --git a/inst/experiments/sf_leafletdraw_intersect.R b/experiments/sf_leafletdraw_intersect.R similarity index 100% rename from inst/experiments/sf_leafletdraw_intersect.R rename to experiments/sf_leafletdraw_intersect.R