11test_that(" st_read and write handle date and time" , {
22 Sys.setenv(TZ = " " ) # local time
3- x = st_sf(a = 1 : 2 , b = c(5.6 ,3 ), dt = Sys.Date()+ 1 : 2 , tm = Sys.time()+ 2 : 3 ,
3+ x = st_sf(a = 1 : 2 , b = c(5.6 ,3 ), dt = Sys.Date()+ 1 : 2 , tm = Sys.time()+ 2 : 3 ,
44 geometry = structure(st_sfc(st_point(c(1 ,1 )), st_point(c(2 ,2 )))))
55 shp <- paste0(tempfile(), " .shp" )
66 gpkg <- paste0(tempfile(), " .gpkg" )
@@ -11,7 +11,7 @@ test_that("st_read and write handle date and time", {
1111 x2 = st_read(shp [1 ], quiet = TRUE )
1212 expect_equal(x [- 4 ], x2 , check.attributes = FALSE )
1313# WKT2 CRS do not roundtrip for ESRI Shapefile
14-
14+
1515 st_write(x , gpkg , quiet = TRUE )
1616 x2 = st_read(gpkg , quiet = TRUE )
1717 expect_equal(x [[" a" ]], x2 [[" a" ]])
@@ -20,18 +20,18 @@ test_that("st_read and write handle date and time", {
2020 expect_equal(x [[" tm" ]], x2 [[" tm" ]])
2121
2222 Sys.setenv(TZ = " UTC" ) # GMT
23- x = st_sf(a = 1 : 2 , b = c(5.6 ,3 ), dt = Sys.Date()+ 1 : 2 , tm = Sys.time()+ 2 : 3 ,
23+ x = st_sf(a = 1 : 2 , b = c(5.6 ,3 ), dt = Sys.Date()+ 1 : 2 , tm = Sys.time()+ 2 : 3 ,
2424 geometry = structure(st_sfc(st_point(c(1 ,1 )), st_point(c(2 ,2 )))))
2525 shp <- paste0(tempfile(), " .shp" )
2626 gpkg <- paste0(tempfile(), " .gpkg" )
27-
27+
2828 st_crs(x ) = st_crs(" ENGCRS[\" Undefined Cartesian SRS with unknown unit\" ,EDATUM[\" Unknown engineering datum\" ],CS[Cartesian,2],AXIS[\" X\" ,unspecified,ORDER[1],LENGTHUNIT[\" unknown\" ,0]],AXIS[\" Y\" ,unspecified,ORDER[2],LENGTHUNIT[\" unknown\" ,0]]]" )
29-
29+
3030 st_write(x [- 4 ], shp [1 ], quiet = TRUE )
3131 x2 = st_read(shp [1 ], quiet = TRUE )
3232 expect_equal(x [- 4 ], x2 , check.attributes = FALSE )
3333# WKT2 CRS do not roundtrip for ESRI Shapefile
34-
34+
3535 st_write(x , gpkg , quiet = TRUE )
3636 x2 = st_read(gpkg , quiet = TRUE )
3737 expect_equal(x [[" a" ]], x2 [[" a" ]])
0 commit comments