Skip to content

Commit

Permalink
Merge pull request #208 from ropensci/drop_rgeos_even_more
Browse files Browse the repository at this point in the history
Remove references to rgeos
  • Loading branch information
mikemahoney218 committed Sep 5, 2023
2 parents bec1868 + 5c8096b commit b5d99ce
Show file tree
Hide file tree
Showing 14 changed files with 0 additions and 264 deletions.
10 changes: 0 additions & 10 deletions NAMESPACE
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
35 changes: 0 additions & 35 deletions R/geojson_json.R
Expand Up @@ -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(
Expand Down Expand Up @@ -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",
Expand Down
33 changes: 0 additions & 33 deletions R/geojson_list.R
Expand Up @@ -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(
Expand Down Expand Up @@ -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",
Expand Down
30 changes: 0 additions & 30 deletions R/mapgist.R
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down
36 changes: 0 additions & 36 deletions R/mapleaflet.R
Expand Up @@ -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")
Expand Down Expand Up @@ -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", ...) {
Expand Down Expand Up @@ -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, ...)
}
Expand Down
12 changes: 0 additions & 12 deletions R/topojson_json.R
Expand Up @@ -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")])))
Expand Down
12 changes: 0 additions & 12 deletions R/topojson_list.R
Expand Up @@ -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")])))
Expand Down
25 changes: 0 additions & 25 deletions R/topojson_write.R
Expand Up @@ -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,
Expand Down
12 changes: 0 additions & 12 deletions man/geojson_json.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions man/geojson_list.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions man/map_gist.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions man/map_leaf.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b5d99ce

Please sign in to comment.