diff --git a/NAMESPACE b/NAMESPACE index ab16123..1149592 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -31,8 +31,6 @@ S3method(geojson_json,SpatialPoints) S3method(geojson_json,SpatialPointsDataFrame) S3method(geojson_json,SpatialPolygons) S3method(geojson_json,SpatialPolygonsDataFrame) -S3method(geojson_json,SpatialRings) -S3method(geojson_json,SpatialRingsDataFrame) S3method(geojson_json,data.frame) S3method(geojson_json,geo_list) S3method(geojson_json,list) @@ -51,8 +49,6 @@ S3method(geojson_list,SpatialPoints) S3method(geojson_list,SpatialPointsDataFrame) S3method(geojson_list,SpatialPolygons) S3method(geojson_list,SpatialPolygonsDataFrame) -S3method(geojson_list,SpatialRings) -S3method(geojson_list,SpatialRingsDataFrame) S3method(geojson_list,data.frame) S3method(geojson_list,geo_list) S3method(geojson_list,json) @@ -106,8 +102,6 @@ S3method(map_gist,SpatialPoints) S3method(map_gist,SpatialPointsDataFrame) S3method(map_gist,SpatialPolygons) S3method(map_gist,SpatialPolygonsDataFrame) -S3method(map_gist,SpatialRings) -S3method(map_gist,SpatialRingsDataFrame) S3method(map_gist,data.frame) S3method(map_gist,geo_list) S3method(map_gist,json) @@ -124,8 +118,6 @@ S3method(map_leaf,SpatialPoints) S3method(map_leaf,SpatialPointsDataFrame) S3method(map_leaf,SpatialPolygons) S3method(map_leaf,SpatialPolygonsDataFrame) -S3method(map_leaf,SpatialRings) -S3method(map_leaf,SpatialRingsDataFrame) S3method(map_leaf,character) S3method(map_leaf,data.frame) S3method(map_leaf,geo_list) @@ -155,8 +147,6 @@ S3method(topojson_write,SpatialPoints) S3method(topojson_write,SpatialPointsDataFrame) S3method(topojson_write,SpatialPolygons) S3method(topojson_write,SpatialPolygonsDataFrame) -S3method(topojson_write,SpatialRings) -S3method(topojson_write,SpatialRingsDataFrame) S3method(topojson_write,data.frame) S3method(topojson_write,default) S3method(topojson_write,geo_list) diff --git a/R/geojson_json.R b/R/geojson_json.R index 55a68e5..e72d5f8 100644 --- a/R/geojson_json.R +++ b/R/geojson_json.R @@ -215,18 +215,6 @@ #' sgdf <- SpatialGridDataFrame(sg, data.frame(val = 1:12)) #' geojson_json(sgdf) #' -#' # From SpatialRings -#' library("rgeos") -#' r1 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "1") -#' r2 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "2") -#' r1r2 <- SpatialRings(list(r1, r2)) -#' geojson_json(r1r2) -#' -#' # From SpatialRingsDataFrame -#' dat <- data.frame(id = c(1, 2), value = 3:4) -#' r1r2df <- SpatialRingsDataFrame(r1r2, data = dat) -#' geojson_json(r1r2df) -#' #' # From SpatialPixels #' library("sp") #' pixels <- suppressWarnings( @@ -448,29 +436,6 @@ geojson_json.sfg <- function(input, lat = NULL, lon = NULL, group = NULL, geoclass(as.json(geojson_list(input, precision = precision), ...), type) } -# spatial classes from rgeos -------------------------- -#' @export -geojson_json.SpatialRings <- function(input, lat = NULL, lon = NULL, - group = NULL, geometry = "point", type = "FeatureCollection", - convert_wgs84 = FALSE, crs = NULL, precision = NULL, ...) { - check_type_sp(type) - geoclass(geojson_rw(input, - target = "char", convert_wgs84 = convert_wgs84, - crs = crs, precision = precision - ), type = type) -} - -#' @export -geojson_json.SpatialRingsDataFrame <- function(input, lat = NULL, lon = NULL, - group = NULL, geometry = "point", type = "FeatureCollection", - convert_wgs84 = FALSE, crs = NULL, precision = NULL, ...) { - check_type_sp(type) - geoclass(geojson_rw(input, - target = "char", convert_wgs84 = convert_wgs84, - crs = crs, precision = precision - ), type = type) -} - #' @export geojson_json.SpatialCollections <- function(input, lat = NULL, lon = NULL, group = NULL, geometry = "point", type = "FeatureCollection", diff --git a/R/geojson_list.R b/R/geojson_list.R index e181828..c285f90 100644 --- a/R/geojson_list.R +++ b/R/geojson_list.R @@ -190,18 +190,6 @@ #' sgdf <- SpatialGridDataFrame(sg, data.frame(val = 1:12)) #' geojson_list(sgdf) #' -#' # From SpatialRings -#' library("rgeos") -#' r1 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "1") -#' r2 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "2") -#' r1r2 <- SpatialRings(list(r1, r2)) -#' geojson_list(r1r2) -#' -#' # From SpatialRingsDataFrame -#' dat <- data.frame(id = c(1, 2), value = 3:4) -#' r1r2df <- SpatialRingsDataFrame(r1r2, data = dat) -#' geojson_list(r1r2df) -#' #' # From SpatialPixels #' library("sp") #' pixels <- suppressWarnings( @@ -366,27 +354,6 @@ geojson_list.SpatialPixelsDataFrame <- function(input, lat = NULL, lon = NULL, ), "SpatialPixelsDataFrame") } -# spatial classes from rgeos -------------------------- -#' @export -geojson_list.SpatialRings <- function(input, lat = NULL, lon = NULL, - group = NULL, geometry = "point", type = "FeatureCollection", - convert_wgs84 = FALSE, crs = NULL, precision = NULL, ...) { - as.geo_list(geojson_rw(input, - target = "list", precision = precision, - convert_wgs84 = convert_wgs84, crs = crs - ), "SpatialRings") -} - -#' @export -geojson_list.SpatialRingsDataFrame <- function(input, lat = NULL, lon = NULL, - group = NULL, geometry = "point", type = "FeatureCollection", - convert_wgs84 = FALSE, crs = NULL, precision = NULL, ...) { - as.geo_list(geojson_rw(input, - target = "list", precision = precision, - convert_wgs84 = convert_wgs84, crs = crs - ), "SpatialRingsDataFrame") -} - #' @export geojson_list.SpatialCollections <- function(input, lat = NULL, lon = NULL, group = NULL, geometry = "point", type = "FeatureCollection", diff --git a/R/mapgist.R b/R/mapgist.R index a948f0d..9b912b5 100644 --- a/R/mapgist.R +++ b/R/mapgist.R @@ -153,17 +153,6 @@ #' ) #' map_gist(pixelsdf) #' -#' # From SpatialRings -#' library("rgeos") -#' r1 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "1") -#' r2 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "2") -#' r1r2 <- SpatialRings(list(r1, r2)) -#' map_gist(r1r2) -#' -#' # From SpatialRingsDataFrame -#' dat <- data.frame(id = c(1, 2), value = 3:4) -#' r1r2df <- SpatialRingsDataFrame(r1r2, data = dat) -#' map_gist(r1r2df) #' } #' } map_gist <- function(input, lat = "lat", lon = "long", geometry = "point", @@ -263,25 +252,6 @@ map_gist.SpatialPixelsDataFrame <- function(input, lat = "lat", lon = "long", ge gistc(input, file, description, public, browse, ...) } -# spatial classes methods from rgeos package -------------------------- -#' @export -map_gist.SpatialRings <- function(input, lat = "lat", lon = "long", geometry = "point", - group = NULL, type = "FeatureCollection", - file = "myfile.geojson", description = "", - public = TRUE, browse = TRUE, ...) { - check4gistr() - gistc(input, file, description, public, browse, ...) -} - -#' @export -map_gist.SpatialRingsDataFrame <- function(input, lat = "lat", lon = "long", geometry = "point", - group = NULL, type = "FeatureCollection", - file = "myfile.geojson", description = "", - public = TRUE, browse = TRUE, ...) { - check4gistr() - gistc(input, file, description, public, browse, ...) -} - # R classes: numeric, data.frame, list ------------------------ #' @export map_gist.numeric <- function(input, lat = "lat", lon = "long", geometry = "point", group = NULL, diff --git a/R/mapleaflet.R b/R/mapleaflet.R index ce1ed87..c677cd7 100644 --- a/R/mapleaflet.R +++ b/R/mapleaflet.R @@ -128,18 +128,6 @@ #' ) #' map_leaf(pixelsdf) #' -#' # From SpatialRings -#' library("rgeos") -#' r1 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "1") -#' r2 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "2") -#' r1r2 <- SpatialRings(list(r1, r2)) -#' map_leaf(r1r2) -#' -#' # From SpatialRingsDataFrame -#' dat <- data.frame(id = c(1, 2), value = 3:4) -#' r1r2df <- SpatialRingsDataFrame(r1r2, data = dat) -#' map_leaf(r1r2df) -#' #' # basemap toggling ------------------------ #' map_leaf(us_cities, basemap = "Acetate.terrain") #' map_leaf(us_cities, basemap = "CartoDB.Positron") @@ -220,24 +208,8 @@ map_leaf.SpatialPixelsDataFrame <- function(input, lat = NULL, lon = NULL, basem petiole(input, bounds = sp_bounds(input), basemap, ...) } -# spatial classes methods from rgeos package -------------------------- -#' @export -map_leaf.SpatialRings <- function(input, lat = NULL, lon = NULL, basemap = "Stamen.Toner", ...) { - check_4_leaflet() - petiole(input, bounds = sp_bounds(input), basemap, ...) -} - -#' @export -map_leaf.SpatialRingsDataFrame <- function(input, lat = NULL, lon = NULL, basemap = "Stamen.Toner", ...) { - check_4_leaflet() - petiole(input, bounds = sp_bounds(input), basemap, ...) -} # R classes: numeric, data.frame, list ------------------------ -# map_leaf.numeric <- function(input, basemap = "Stamen.Toner", ...) { -# check_4_leaflet() -# petiole(input, basemap, ...) -# } #' @export map_leaf.data.frame <- function(input, lat = NULL, lon = NULL, basemap = "Stamen.Toner", ...) { @@ -341,14 +313,6 @@ rachis.SpatialPixelsDataFrame <- function(x, leaflet_obj, ...) { leaflet::addMarkers(leaflet_obj, data = as(x, "SpatialPoints"), ...) } -rachis.SpatialRings <- function(x, leaflet_obj, ...) { - leaflet::addPolygons(leaflet_obj, data = as(x, "SpatialPolygonsDataFrame"), ...) -} - -rachis.SpatialRingsDataFrame <- function(x, leaflet_obj, ...) { - leaflet::addPolygons(leaflet_obj, data = as(x, "SpatialPolygonsDataFrame"), ...) -} - rachis.data.frame <- function(x, leaflet_obj, ...) { leaflet::addMarkers(leaflet_obj, data = x, ...) } diff --git a/R/topojson_json.R b/R/topojson_json.R index 7e758a0..cce1a29 100644 --- a/R/topojson_json.R +++ b/R/topojson_json.R @@ -131,18 +131,6 @@ #' sgdf <- SpatialGridDataFrame(sg, data.frame(val = 1:12)) #' topojson_json(sgdf) #' -#' # From SpatialRings -#' library("rgeos") -#' r1 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "1") -#' r2 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "2") -#' r1r2 <- SpatialRings(list(r1, r2)) -#' topojson_json(r1r2) -#' -#' # From SpatialRingsDataFrame -#' dat <- data.frame(id = c(1, 2), value = 3:4) -#' r1r2df <- SpatialRingsDataFrame(r1r2, data = dat) -#' topojson_json(r1r2df) -#' #' # From SpatialPixels #' library("sp") #' pixels <- suppressWarnings(SpatialPixels(SpatialPoints(us_cities[c("long", "lat")]))) diff --git a/R/topojson_list.R b/R/topojson_list.R index 0765d8c..48275ac 100644 --- a/R/topojson_list.R +++ b/R/topojson_list.R @@ -108,18 +108,6 @@ #' sgdf <- SpatialGridDataFrame(sg, data.frame(val = 1:12)) #' topojson_list(sgdf) #' -#' # From SpatialRings -#' library("rgeos") -#' r1 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "1") -#' r2 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "2") -#' r1r2 <- SpatialRings(list(r1, r2)) -#' topojson_list(r1r2) -#' -#' # From SpatialRingsDataFrame -#' dat <- data.frame(id = c(1, 2), value = 3:4) -#' r1r2df <- SpatialRingsDataFrame(r1r2, data = dat) -#' topojson_list(r1r2df) -#' #' # From SpatialPixels #' library("sp") #' pixels <- suppressWarnings(SpatialPixels(SpatialPoints(us_cities[c("long", "lat")]))) diff --git a/R/topojson_write.R b/R/topojson_write.R index ce01985..3a428d9 100644 --- a/R/topojson_write.R +++ b/R/topojson_write.R @@ -178,31 +178,6 @@ topojson_write.SpatialPixelsDataFrame <- function(input, lat = NULL, lon = NULL, ) } -## spatial classes from rgeos ----------------- -#' @export -topojson_write.SpatialRings <- function(input, lat = NULL, lon = NULL, geometry = "point", - group = NULL, file = "myfile.topojson", - overwrite = TRUE, precision = NULL, - convert_wgs84 = FALSE, crs = NULL, - object_name = "foo", quantization = 0, ...) { - sp_helper(input, - file = file, precision = precision, - convert_wgs84 = convert_wgs84, crs = crs, - class = "SpatialRings", object_name = object_name, quantization = quantization, ... - ) -} - -#' @export -topojson_write.SpatialRingsDataFrame <- function(input, lat = NULL, lon = NULL, - geometry = "point", group = NULL, file = "myfile.topojson", overwrite = TRUE, - precision = NULL, convert_wgs84 = FALSE, crs = NULL, object_name = "foo", quantization = 0, ...) { - sp_helper(input, - file = file, precision = precision, - convert_wgs84 = convert_wgs84, crs = crs, - class = "SpatialRingsDataFrame", object_name = object_name, quantization = quantization, ... - ) -} - #' @export topojson_write.SpatialCollections <- function(input, lat = NULL, lon = NULL, geometry = "point", group = NULL, file = "myfile.topojson", overwrite = TRUE, diff --git a/man/geojson_json.Rd b/man/geojson_json.Rd index b2d9324..ece76ca 100644 --- a/man/geojson_json.Rd +++ b/man/geojson_json.Rd @@ -249,18 +249,6 @@ sg <- SpatialGrid(GridTopology(rep(0, 2), rep(10, 2), sgdim)) sgdf <- SpatialGridDataFrame(sg, data.frame(val = 1:12)) geojson_json(sgdf) -# From SpatialRings -library("rgeos") -r1 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "1") -r2 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "2") -r1r2 <- SpatialRings(list(r1, r2)) -geojson_json(r1r2) - -# From SpatialRingsDataFrame -dat <- data.frame(id = c(1, 2), value = 3:4) -r1r2df <- SpatialRingsDataFrame(r1r2, data = dat) -geojson_json(r1r2df) - # From SpatialPixels library("sp") pixels <- suppressWarnings( diff --git a/man/geojson_list.Rd b/man/geojson_list.Rd index 7eec8c7..63b3861 100644 --- a/man/geojson_list.Rd +++ b/man/geojson_list.Rd @@ -220,18 +220,6 @@ sg <- SpatialGrid(GridTopology(rep(0, 2), rep(10, 2), sgdim)) sgdf <- SpatialGridDataFrame(sg, data.frame(val = 1:12)) geojson_list(sgdf) -# From SpatialRings -library("rgeos") -r1 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "1") -r2 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "2") -r1r2 <- SpatialRings(list(r1, r2)) -geojson_list(r1r2) - -# From SpatialRingsDataFrame -dat <- data.frame(id = c(1, 2), value = 3:4) -r1r2df <- SpatialRingsDataFrame(r1r2, data = dat) -geojson_list(r1r2df) - # From SpatialPixels library("sp") pixels <- suppressWarnings( diff --git a/man/map_gist.Rd b/man/map_gist.Rd index 7fb460d..8107236 100644 --- a/man/map_gist.Rd +++ b/man/map_gist.Rd @@ -183,17 +183,6 @@ if (!identical(Sys.getenv("GITHUB_PAT"), "")) { ) map_gist(pixelsdf) - # From SpatialRings - library("rgeos") - r1 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "1") - r2 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "2") - r1r2 <- SpatialRings(list(r1, r2)) - map_gist(r1r2) - - # From SpatialRingsDataFrame - dat <- data.frame(id = c(1, 2), value = 3:4) - r1r2df <- SpatialRingsDataFrame(r1r2, data = dat) - map_gist(r1r2df) } } } diff --git a/man/map_leaf.Rd b/man/map_leaf.Rd index 4ad0342..3b4b978 100644 --- a/man/map_leaf.Rd +++ b/man/map_leaf.Rd @@ -142,18 +142,6 @@ pixelsdf <- suppressWarnings( ) map_leaf(pixelsdf) -# From SpatialRings -library("rgeos") -r1 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "1") -r2 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "2") -r1r2 <- SpatialRings(list(r1, r2)) -map_leaf(r1r2) - -# From SpatialRingsDataFrame -dat <- data.frame(id = c(1, 2), value = 3:4) -r1r2df <- SpatialRingsDataFrame(r1r2, data = dat) -map_leaf(r1r2df) - # basemap toggling ------------------------ map_leaf(us_cities, basemap = "Acetate.terrain") map_leaf(us_cities, basemap = "CartoDB.Positron") diff --git a/man/topojson_json.Rd b/man/topojson_json.Rd index 7e1e4ed..92f23e3 100644 --- a/man/topojson_json.Rd +++ b/man/topojson_json.Rd @@ -202,18 +202,6 @@ sg <- SpatialGrid(GridTopology(rep(0, 2), rep(10, 2), sgdim)) sgdf <- SpatialGridDataFrame(sg, data.frame(val = 1:12)) topojson_json(sgdf) -# From SpatialRings -library("rgeos") -r1 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "1") -r2 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "2") -r1r2 <- SpatialRings(list(r1, r2)) -topojson_json(r1r2) - -# From SpatialRingsDataFrame -dat <- data.frame(id = c(1, 2), value = 3:4) -r1r2df <- SpatialRingsDataFrame(r1r2, data = dat) -topojson_json(r1r2df) - # From SpatialPixels library("sp") pixels <- suppressWarnings(SpatialPixels(SpatialPoints(us_cities[c("long", "lat")]))) diff --git a/man/topojson_list.Rd b/man/topojson_list.Rd index eadc171..ce2ca9f 100644 --- a/man/topojson_list.Rd +++ b/man/topojson_list.Rd @@ -174,18 +174,6 @@ sg <- SpatialGrid(GridTopology(rep(0, 2), rep(10, 2), sgdim)) sgdf <- SpatialGridDataFrame(sg, data.frame(val = 1:12)) topojson_list(sgdf) -# From SpatialRings -library("rgeos") -r1 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "1") -r2 <- Ring(cbind(x = c(1, 1, 2, 2, 1), y = c(1, 2, 2, 1, 1)), ID = "2") -r1r2 <- SpatialRings(list(r1, r2)) -topojson_list(r1r2) - -# From SpatialRingsDataFrame -dat <- data.frame(id = c(1, 2), value = 3:4) -r1r2df <- SpatialRingsDataFrame(r1r2, data = dat) -topojson_list(r1r2df) - # From SpatialPixels library("sp") pixels <- suppressWarnings(SpatialPixels(SpatialPoints(us_cities[c("long", "lat")])))