R Under development (unstable) (2023-07-09 r84667 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > suppressPackageStartupMessages(library(sf)) > options(rgdal_show_exportToProj4_warnings = "none") > suppressWarnings(st_crs(-1)) Coordinate Reference System: NA > suppressWarnings(st_crs(999999)) Coordinate Reference System: NA > inherits(try(st_crs("error"), silent = TRUE), "try-error") [1] TRUE > str = "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.4171,50.3319,465.5524,-0.398957388243134,0.343987817378283,-1.87740163998045,4.0725 +units=m +no_defs" > x <- st_crs(str) > x<- st_crs(3857) > str = st_crs(3857)$proj4string > st_crs(3857)$units [1] "m" > x = st_crs("+proj=longlat +datum=WGS84") > x = st_crs(4326) > x = st_crs("+proj=laea") # no EPSG > > x = st_sfc(st_point(0:1)) > y = st_crs(x, parameters = TRUE) > st_crs(x) = 4326 > y = st_crs(x, parameters = TRUE) > > from = st_crs(4326)$proj4string > to = st_crs(3857)$proj4string > ret = sf_project(from, to, rbind(c(0,0), c(1,1))) > round(ret, 7) [,1] [,2] [1,] 0.0 0.0 [2,] 111319.5 111325.1 > # create Inf points: #1227/#1228 > suppressWarnings( + sf_project("+proj=longlat", "+proj=lcc +lat_1=30 +lat_2=60", cbind(c(0,0),c(-80,-90)), keep = TRUE) + ) [,1] [,2] [1,] 0 -53554590 [2,] NA NA > sf_project(to, from, ret) [,1] [,2] [1,] 0 0 [2,] 1 1 > suppressWarnings( + sf_project("+proj=longlat", "+proj=lcc +lat_1=30 +lat_2=60", cbind(c(0,0),c(-80,-90)), keep = TRUE) + ) [,1] [,2] [1,] 0 -53554590 [2,] NA NA > st_transform(st_sfc(st_point(c(0,0)), st_point(c(1,1)), crs = 4326), 3857) Geometry set for 2 features Geometry type: POINT Dimension: XY Bounding box: xmin: 0 ymin: 0 xmax: 111319.5 ymax: 111325.1 Projected CRS: WGS 84 / Pseudo-Mercator POINT (0 0) POINT (111319.5 111325.1) > if (Sys.getenv("USER") %in% c("edzer", "travis")) { # causes memory leaks: + stopifnot(inherits(try(sf_project("+proj=longlat", "+proj=bar", matrix(1:4,2)), silent = TRUE), "try-error")) + stopifnot(inherits(try(sf_project("+proj=foo", "+proj=longlat", matrix(1:4,2)), silent = TRUE), "try-error")) + } > > if (sf_extSoftVersion()["USE_PROJ_H"] == "true" || sf_proj_info("have_datum_files")) { + "datum files installed" + } else { + "datum files not installed" + } [1] "datum files installed" > > if (suppressPackageStartupMessages(require(sp, quietly = TRUE))) { + x0 = sp::CRS("+init=epsg:4326") + cat(sp::wkt(x0), "\n") + x = st_crs(x0) + print(x) + + y0 = st_crs(4326) + y0 + y = as(y0, "CRS") + cat(sp::wkt(y), "\n") + } GEOGCRS["WGS 84", ENSEMBLE["World Geodetic System 1984 ensemble", MEMBER["World Geodetic System 1984 (Transit)", ID["EPSG",1166]], MEMBER["World Geodetic System 1984 (G730)", ID["EPSG",1152]], MEMBER["World Geodetic System 1984 (G873)", ID["EPSG",1153]], MEMBER["World Geodetic System 1984 (G1150)", ID["EPSG",1154]], MEMBER["World Geodetic System 1984 (G1674)", ID["EPSG",1155]], MEMBER["World Geodetic System 1984 (G1762)", ID["EPSG",1156]], MEMBER["World Geodetic System 1984 (G2139)", ID["EPSG",1309]], ELLIPSOID["WGS 84",6378137,298.257223563, LENGTHUNIT["metre",1], ID["EPSG",7030]], ENSEMBLEACCURACY[2.0], ID["EPSG",6326]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8901]], CS[ellipsoidal,2], AXIS["longitude",east, ORDER[1], ANGLEUNIT["degree",0.0174532925199433, ID["EPSG",9122]]], AXIS["latitude",north, ORDER[2], ANGLEUNIT["degree",0.0174532925199433, ID["EPSG",9122]]], USAGE[ SCOPE["unknown"], AREA["World."], BBOX[-90,-180,90,180]]] Coordinate Reference System: User input: WGS 84 wkt: GEOGCRS["WGS 84", ENSEMBLE["World Geodetic System 1984 ensemble", MEMBER["World Geodetic System 1984 (Transit)", ID["EPSG",1166]], MEMBER["World Geodetic System 1984 (G730)", ID["EPSG",1152]], MEMBER["World Geodetic System 1984 (G873)", ID["EPSG",1153]], MEMBER["World Geodetic System 1984 (G1150)", ID["EPSG",1154]], MEMBER["World Geodetic System 1984 (G1674)", ID["EPSG",1155]], MEMBER["World Geodetic System 1984 (G1762)", ID["EPSG",1156]], MEMBER["World Geodetic System 1984 (G2139)", ID["EPSG",1309]], ELLIPSOID["WGS 84",6378137,298.257223563, LENGTHUNIT["metre",1], ID["EPSG",7030]], ENSEMBLEACCURACY[2.0], ID["EPSG",6326]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8901]], CS[ellipsoidal,2], AXIS["longitude",east, ORDER[1], ANGLEUNIT["degree",0.0174532925199433, ID["EPSG",9122]]], AXIS["latitude",north, ORDER[2], ANGLEUNIT["degree",0.0174532925199433, ID["EPSG",9122]]], USAGE[ SCOPE["unknown"], AREA["World."], BBOX[-90,-180,90,180]]] GEOGCRS["WGS 84", ENSEMBLE["World Geodetic System 1984 ensemble", MEMBER["World Geodetic System 1984 (Transit)"], MEMBER["World Geodetic System 1984 (G730)"], MEMBER["World Geodetic System 1984 (G873)"], MEMBER["World Geodetic System 1984 (G1150)"], MEMBER["World Geodetic System 1984 (G1674)"], MEMBER["World Geodetic System 1984 (G1762)"], MEMBER["World Geodetic System 1984 (G2139)"], ELLIPSOID["WGS 84",6378137,298.257223563, LENGTHUNIT["metre",1]], ENSEMBLEACCURACY[2.0]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433]], CS[ellipsoidal,2], AXIS["geodetic latitude (Lat)",north, ORDER[1], ANGLEUNIT["degree",0.0174532925199433]], AXIS["geodetic longitude (Lon)",east, ORDER[2], ANGLEUNIT["degree",0.0174532925199433]], USAGE[ SCOPE["Horizontal component of 3D system."], AREA["World."], BBOX[-90,-180,90,180]], ID["EPSG",4326]] Warning message: In CPL_crs_from_input(x) : GDAL Message 1: +init=epsg:XXXX syntax is deprecated. It might return a CRS with a non-EPSG compliant axis order. > > # https://github.com/r-spatial/sf/issues/1170 > g = st_as_sfc("POLYGON ((-61.66957 10.69214, -61.565 10.75728, -61.37453 10.77654, -61.40721 10.60681, -61.66957 10.69214))") > d = st_as_sf(data.frame(id=1, geometry=g), crs=4326) > st_area(d) 350534486 [m^2] > st_area(st_transform(d, 2314)) 349124497 [m^2] > > st_axis_order() [1] FALSE > if (compareVersion(sf_extSoftVersion()["GDAL"], "2.5.0") > -1) + st_axis_order(TRUE) > st_axis_order(FALSE) > > proc.time() user system elapsed 1.10 0.18 1.26