[R-sig-Geo] testing a crs string

Edzer Pebesma edzer@pebe@m@ @end|ng |rom un|-muen@ter@de
Thu Jun 20 16:42:03 CEST 2019



On 6/20/19 4:18 PM, Roy Mendelssohn - NOAA Federal via R-sig-Geo wrote:
> Hi All:
> 
> I am extending a package I have to allow users to provide a crs string, which will eventually through some other packages be sent to sf.  I like to try and make at least minimal tests that inputs are valid.  Is there some existing code that will check if a string is a valid crs string?

> inherits(try(sf::st_crs("+proj=invalid"), silent = TRUE), "try-error")
[1] TRUE
> inherits(try(sf::st_crs("+proj=longlat"), silent = TRUE), "try-error")
[1] FALSE


> 
> Thanks,
> 
> -Roy
> 
> 
> **********************
> "The contents of this message do not reflect any position of the U.S. Government or NOAA."
> **********************
> Roy Mendelssohn
> Supervisory Operations Research Analyst
> NOAA/NMFS
> Environmental Research Division
> Southwest Fisheries Science Center
> ***Note new street address***
> 110 McAllister Way
> Santa Cruz, CA 95060
> Phone: (831)-420-3666
> Fax: (831) 420-3980
> e-mail: Roy.Mendelssohn using noaa.gov www: http://www.pfeg.noaa.gov/
> 
> "Old age and treachery will overcome youth and skill."
> "From those who have been given much, much will be expected" 
> "the arc of the moral universe is long, but it bends toward justice" -MLK Jr.
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Edzer Pebesma
Institute for Geoinformatics
Heisenbergstrasse 2, 48151 Muenster, Germany
Phone: +49 251 8333081

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pEpkey.asc
Type: application/pgp-keys
Size: 2472 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20190620/b37d7539/attachment.bin>


More information about the R-sig-Geo mailing list