
R Under development (unstable) (2025-11-05 r88988 ucrt) -- "Unsuffered Consequences"
Copyright (C) 2025 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 (sf_extSoftVersion()["USE_PROJ_H"] == "true" || sf_proj_info("have_datum_files")) {
+   "datum files installed"
+ } else {
+   "datum files not installed"
+ }
[1] "datum files installed"
> 
> # 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 
   0.51    0.20    0.70 
