Skip to content

Commit

Permalink
Merge pull request #47 from timelyportfolio/master
Browse files Browse the repository at this point in the history
minor changes from CRAN submission
  • Loading branch information
timelyportfolio authored Jun 30, 2017
2 parents 9ecf44b + 765f751 commit 00ff8ab
Show file tree
Hide file tree
Showing 19 changed files with 175 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
^README\.Rmd$
^README-.*\.png$
^CONDUCT\.md$
^experiments
^cran-comments\.md$
11 changes: 5 additions & 6 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
16 changes: 16 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -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.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
147 changes: 147 additions & 0 deletions experiments/flubber_playback.R
Original file line number Diff line number Diff line change
@@ -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)
Binary file added experiments/flubber_playback.RData
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 00ff8ab

Please sign in to comment.