
CRS
-class object and a
PostgreSQL database connection (with PostGIS extension), and
returns the matching SRID(s) for that CRS. If a match is not
found, a new entry can be created in the PostgreSQL
spatial_ref_sys
table using the parameters specified by the
CRS. New entries will be created with auth_name =
'rpostgis_custom'
, with the default value being the next open value
between 880001-889999 (a different SRID value can be entered if desired.)
pgSRID(conn, crs, create.srid = FALSE, new.srid = NULL)
CRS
.spatial_ref_sys
table.srid
in spatial_ref_sys
between 880001 and
889999 will be used.## Not run:
# drv <- dbDriver("PostgreSQL")
# conn <- dbConnect(drv, dbname = "dbname", host = "host", port = "5432",
# user = "user", password = "password")
# (crs <- CRS("+proj=longlat"))
# pgSRID(conn, crs)
# (crs2 <- CRS(paste("+proj=stere", "+lat_0=52.15616055555555 +lon_0=5.38763888888889",
# "+k=0.999908 +x_0=155000 +y_0=463000", "+ellps=bessel",
# "+towgs84=565.237,50.0087,465.658,-0.406857,0.350733,-1.87035,4.0812",
# "+units=m")))
# pgSRID(conn, crs2, create.srid = TRUE)
# ## End(Not run)
Run the code above in your browser using DataLab