Skip to content

Commit df47fd2

Browse files
committed
updating DATASET to remove rgdal/rgeos
1 parent 09c5e22 commit df47fd2

File tree

6 files changed

+10
-3
lines changed

6 files changed

+10
-3
lines changed

DESCRIPTION

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Imports:
3030
spatstat.utils,
3131
rgeos,
3232
terra,
33+
sf,
3334
stats,
3435
methods
3536
Depends:

data-raw/DATASET.R

+9-3
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,19 @@ nyc_borough <- function(){
5757
temp <- tempfile("nybb_21c",fileext = ".zip")
5858
download.file(bor_url,temp)
5959
unzip(temp,exdir=path.expand('~/temp'))
60-
res_bor <- rgdal::readOGR(dsn=path.expand('~/temp/nybb_21c/nybb.shp'),layer='nybb',p4s=pr,verbose=FALSE)
60+
#res_bor <- rgdal::readOGR(dsn=path.expand('~/temp/nybb_21c/nybb.shp'),layer='nybb',p4s=pr,verbose=FALSE)
61+
shp <- path.expand('~/temp/nybb_21c/nybb.shp')
62+
res_bor <- terra::vect(shp)
6163
# Clean up the files
6264
unlink(temp)
6365
unlink(path.expand('~/temp/nybb_21c'),recursive=TRUE,force=TRUE)
6466
# Simplifying the boundary a bit to make file smaller
65-
nyc_simpler <- rgeos::gSimplify(res_bor, 500, topologyPreserve=TRUE)
66-
return(nyc_simpler)
67+
#nyc_simpler <- rgeos::gSimplify(res_bor, 500, topologyPreserve=TRUE)
68+
nyc_simpler <- terra::simplifyGeom(res_bor, 500)
69+
nyc_sf <- sf::st_as_sf(nyc_simpler)
70+
nyc_sp <- sf::as_Spatial(nyc_sf)
71+
sp::proj4string(nyc_sp) <- pr
72+
return(nyc_sp)
6773
}
6874

6975
nyc_bor <- nyc_borough()

data/nyc_bor.rda

-3.06 KB
Binary file not shown.

data/nyc_cafe.rda

577 Bytes
Binary file not shown.

data/nyc_liq.rda

185 KB
Binary file not shown.

data/nyc_shoot.rda

11.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)