Giter VIP home page Giter VIP logo

Comments (3)

edzer avatar edzer commented on August 17, 2024 1

See here. PROJ reads datum transformation grids from the CDN and stores (parts of them) in a local cache, if it is instructed to do so. terra instructs it to do so, sf does not but allows users to do this using sf_proj_network(TRUE).

Be careful with the script below, as it tries to remove your local PROJ cache.

library(sf)
# Linking to GEOS 3.12.1, GDAL 3.8.4, PROJ 9.3.1; sf_use_s2() is TRUE
df <- data.frame(lng = -73587364, lat = 45.507026)
df <- st_as_sf(df, coords = c("lng", "lat"), crs = 4326)

# no terra:
sf_proj_network()
# [1] FALSE
system.time(df <- st_transform(df, crs = 32198))
#    user  system elapsed 
#   0.015   0.000   0.015 
sf_proj_pipelines(st_crs(4326), st_crs(32198))
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# hgridshift: could not find required grid(s).
# pipeline: Pipeline: Bad step definition: inv (File not found or invalid)
# Candidate coordinate operations found:  53 
# Strict containment:     FALSE 
# Axis order auth compl:  FALSE 
# Source:  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]] 
# Target:  PROJCRS["NAD83 / Quebec Lambert",
#     BASEGEOGCRS["NAD83",
#         DATUM["North American Datum 1983",
#             ELLIPSOID["GRS 1980",6378137,298.257222101,
#                 LENGTHUNIT["metre",1]]],
#         PRIMEM["Greenwich",0,
#             ANGLEUNIT["degree",0.0174532925199433]],
#         ID["EPSG",4269]],
#     CONVERSION["Quebec Lambert Projection",
#         METHOD["Lambert Conic Conformal (2SP)",
#             ID["EPSG",9802]],
#         PARAMETER["Latitude of false origin",44,
#             ANGLEUNIT["degree",0.0174532925199433],
#             ID["EPSG",8821]],
#         PARAMETER["Longitude of false origin",-68.5,
#             ANGLEUNIT["degree",0.0174532925199433],
#             ID["EPSG",8822]],
#         PARAMETER["Latitude of 1st standard parallel",60,
#             ANGLEUNIT["degree",0.0174532925199433],
#             ID["EPSG",8823]],
#         PARAMETER["Latitude of 2nd standard parallel",46,
#             ANGLEUNIT["degree",0.0174532925199433],
#             ID["EPSG",8824]],
#         PARAMETER["Easting at false origin",0,
#             LENGTHUNIT["metre",1],
#             ID["EPSG",8826]],
#         PARAMETER["Northing at false origin",0,
#             LENGTHUNIT["metre",1],
#             ID["EPSG",8827]]],
#     CS[Cartesian,2],
#         AXIS["easting (X)",east,
#             ORDER[1],
#             LENGTHUNIT["metre",1]],
#         AXIS["northing (Y)",north,
#             ORDER[2],
#             LENGTHUNIT["metre",1]],
#     USAGE[
#         SCOPE["Topographic mapping (medium and small scale)."],
#         AREA["Canada - Quebec."],
#         BBOX[44.99,-79.85,62.62,-57.1]],
#     ID["EPSG",32198]] 
# Best instantiable operation has accuracy: 4 m
# Description: axis order change (2D) + Inverse of NAD83 to WGS 84 (1) +
#              Quebec Lambert Projection
# Definition:  +proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad
#              +step +proj=lcc +lat_0=44 +lon_0=-68.5 +lat_1=60
#              +lat_2=46 +x_0=0 +y_0=0 +ellps=GRS80
# Operation 4 is lacking 1 grid with accuracy 1.5 m
# Missing grid: ca_nrc_NA83SCRS.tif 
# URL: https://cdn.proj.org/ca_nrc_NA83SCRS.tif 
# Operation 5 is lacking 1 grid with accuracy 1.5 m
# Missing grid: ca_nrc_ABCSRSV4.tif 
# URL: https://cdn.proj.org/ca_nrc_ABCSRSV4.tif 
# Operation 6 is lacking 1 grid with accuracy 1.5 m
# Missing grid: ca_nrc_SK83-98.tif 
# URL: https://cdn.proj.org/ca_nrc_SK83-98.tif 
# Operation 7 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_ethpgn.tif 
# URL: https://cdn.proj.org/us_noaa_ethpgn.tif 
# Operation 8 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_wthpgn.tif 
# URL: https://cdn.proj.org/us_noaa_wthpgn.tif 
# Operation 9 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_FL.tif 
# URL: https://cdn.proj.org/us_noaa_FL.tif 
# Operation 10 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_emhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_emhpgn.tif 
# Operation 11 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_WO.tif 
# URL: https://cdn.proj.org/us_noaa_WO.tif 
# Operation 12 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_mihpgn.tif 
# URL: https://cdn.proj.org/us_noaa_mihpgn.tif 
# Operation 13 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_cnhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_cnhpgn.tif 
# Operation 14 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_nvhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_nvhpgn.tif 
# Operation 15 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_mnhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_mnhpgn.tif 
# Operation 16 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_nmhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_nmhpgn.tif 
# Operation 17 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_azhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_azhpgn.tif 
# Operation 18 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_nyhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_nyhpgn.tif 
# Operation 19 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_cshpgn.tif 
# URL: https://cdn.proj.org/us_noaa_cshpgn.tif 
# Operation 20 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_mohpgn.tif 
# URL: https://cdn.proj.org/us_noaa_mohpgn.tif 
# Operation 21 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_okhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_okhpgn.tif 
# Operation 22 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_WI.tif 
# URL: https://cdn.proj.org/us_noaa_WI.tif 
# Operation 23 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_cohpgn.tif 
# URL: https://cdn.proj.org/us_noaa_cohpgn.tif 
# Operation 24 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_wmhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_wmhpgn.tif 
# Operation 25 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_wyhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_wyhpgn.tif 
# Operation 26 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_nchpgn.tif 
# URL: https://cdn.proj.org/us_noaa_nchpgn.tif 
# Operation 27 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_nbhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_nbhpgn.tif 
# Operation 28 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_uthpgn.tif 
# URL: https://cdn.proj.org/us_noaa_uthpgn.tif 
# Operation 29 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_vahpgn.tif 
# URL: https://cdn.proj.org/us_noaa_vahpgn.tif 
# Operation 30 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_ilhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_ilhpgn.tif 
# Operation 31 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_sdhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_sdhpgn.tif 
# Operation 32 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_lahpgn.tif 
# URL: https://cdn.proj.org/us_noaa_lahpgn.tif 
# Operation 33 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_gahpgn.tif 
# URL: https://cdn.proj.org/us_noaa_gahpgn.tif 
# Operation 34 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_hihpgn.tif 
# URL: https://cdn.proj.org/us_noaa_hihpgn.tif 
# Operation 35 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_kshpgn.tif 
# URL: https://cdn.proj.org/us_noaa_kshpgn.tif 
# Operation 36 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_kyhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_kyhpgn.tif 
# Operation 37 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_ndhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_ndhpgn.tif 
# Operation 38 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_iahpgn.tif 
# URL: https://cdn.proj.org/us_noaa_iahpgn.tif 
# Operation 39 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_mshpgn.tif 
# URL: https://cdn.proj.org/us_noaa_mshpgn.tif 
# Operation 40 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_alhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_alhpgn.tif 
# Operation 41 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_arhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_arhpgn.tif 
# Operation 42 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_wvhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_wvhpgn.tif 
# Operation 43 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_mehpgn.tif 
# URL: https://cdn.proj.org/us_noaa_mehpgn.tif 
# Operation 44 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_ohhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_ohhpgn.tif 
# Operation 45 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_schpgn.tif 
# URL: https://cdn.proj.org/us_noaa_schpgn.tif 
# Operation 46 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_pahpgn.tif 
# URL: https://cdn.proj.org/us_noaa_pahpgn.tif 
# Operation 47 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_nehpgn.tif 
# URL: https://cdn.proj.org/us_noaa_nehpgn.tif 
# Operation 48 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_TN.tif 
# URL: https://cdn.proj.org/us_noaa_TN.tif 
# Operation 49 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_inhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_inhpgn.tif 
# Operation 50 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_MD.tif 
# URL: https://cdn.proj.org/us_noaa_MD.tif 
# Operation 51 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_njhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_njhpgn.tif 
# Operation 52 is lacking 1 grid with accuracy 2 m
# Missing grid: us_noaa_pvhpgn.tif 
# URL: https://cdn.proj.org/us_noaa_pvhpgn.tif 

# with terra:
file.remove("~/.local/share/proj/cache.db") # please check you want this!
# [1] TRUE
library(terra)
# terra 1.7.71
sf_proj_network() # now TRUE, but warns:
# [1] TRUE
# Warning message:
# In CPL_is_network_enabled() :
#   GDAL and PROJ have different settings for network enablement; use sf_use_network() to sync them
sf_proj_network(TRUE) 
# [1] "https://cdn.proj.org"
system.time(df <- st_transform(df, crs = 32198)) # reads datum grid
#    user  system elapsed 
#   0.003   0.000   0.004 

sf_proj_pipelines(st_crs(4326), st_crs(32198))
# Candidate coordinate operations found:  53 
# Strict containment:     FALSE 
# Axis order auth compl:  FALSE 
# Source:  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]] 
# Target:  PROJCRS["NAD83 / Quebec Lambert",
#     BASEGEOGCRS["NAD83",
#         DATUM["North American Datum 1983",
#             ELLIPSOID["GRS 1980",6378137,298.257222101,
#                 LENGTHUNIT["metre",1]]],
#         PRIMEM["Greenwich",0,
#             ANGLEUNIT["degree",0.0174532925199433]],
#         ID["EPSG",4269]],
#     CONVERSION["Quebec Lambert Projection",
#         METHOD["Lambert Conic Conformal (2SP)",
#             ID["EPSG",9802]],
#         PARAMETER["Latitude of false origin",44,
#             ANGLEUNIT["degree",0.0174532925199433],
#             ID["EPSG",8821]],
#         PARAMETER["Longitude of false origin",-68.5,
#             ANGLEUNIT["degree",0.0174532925199433],
#             ID["EPSG",8822]],
#         PARAMETER["Latitude of 1st standard parallel",60,
#             ANGLEUNIT["degree",0.0174532925199433],
#             ID["EPSG",8823]],
#         PARAMETER["Latitude of 2nd standard parallel",46,
#             ANGLEUNIT["degree",0.0174532925199433],
#             ID["EPSG",8824]],
#         PARAMETER["Easting at false origin",0,
#             LENGTHUNIT["metre",1],
#             ID["EPSG",8826]],
#         PARAMETER["Northing at false origin",0,
#             LENGTHUNIT["metre",1],
#             ID["EPSG",8827]]],
#     CS[Cartesian,2],
#         AXIS["easting (X)",east,
#             ORDER[1],
#             LENGTHUNIT["metre",1]],
#         AXIS["northing (Y)",north,
#             ORDER[2],
#             LENGTHUNIT["metre",1]],
#     USAGE[
#         SCOPE["Topographic mapping (medium and small scale)."],
#         AREA["Canada - Quebec."],
#         BBOX[44.99,-79.85,62.62,-57.1]],
#     ID["EPSG",32198]] 
# Best instantiable operation has accuracy: 1.5 m
# Description: axis order change (2D) + Inverse of NAD83 to WGS 84 (6) +
#              Quebec Lambert Projection
# Definition:  +proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad
#              +step +inv +proj=hgridshift
#              +grids=ca_nrc_NA83SCRS.tif +step +proj=lcc
#              +lat_0=44 +lon_0=-68.5 +lat_1=60 +lat_2=46 +x_0=0
#              +y_0=0 +ellps=GRS80

from sf.

edzer avatar edzer commented on August 17, 2024

Do note that after loading terra (if after setting sf_proj_network(TRUE), st_transform() (PROJ) reads in this case (from) a datum transformation grid, and you do get a slightly different, more precise result. For me (also Ubuntu), doing this the first time is slow, the second fast as it seems to read the transformation grid from the local cache.

from sf.

edzer avatar edzer commented on August 17, 2024

See also https://github.com/rspatial/terra/issues?q=sf_proj_network

from sf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.