[R-sig-Geo] GDALinfo with unrecognized format...

Michael Sumner mdsumner at gmail.com
Tue Jul 27 01:54:54 CEST 2010


You can wrap it in a ?try:

f <- "file"
#f <- "utm55.tif"

info <- try(GDALinfo(f), silent = TRUE)

if (inherits(info, "try-error")) {
	## do something else
	stop("no good, file not found: ", f)
	
} else {
	## proceed
	d <- readGDAL(f)
}



On Tue, Jul 27, 2010 at 8:29 AM, Jonathan Greenberg
<greenberg at ucdavis.edu> wrote:
> r-sig-geo'ers:
>
> Quick question: is there an easy way to have a flag to tell if a
> dataset is NOT supported, e.g. when GDALinfo(fname) is in error?  I'd
> like something like "GDALinfo(fname)" to return "FALSE" if its an
> unsupported dataset type.  Thanks!
>
> --j
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



-- 
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania
Hobart, Australia
e-mail: mdsumner at gmail.com



More information about the R-sig-Geo mailing list