[R-sig-Geo] How to test for a layer in GRASS GIS mapset using rgrass7

Christian Willmes c@willme@ @ending from uni-koeln@de
Wed Dec 5 09:24:20 CET 2018


Am 04.12.18 um 20:55 schrieb Roger Bivand:
> You need to wrap the test in try() if it may not succeed (in nc):
>
> oo <- try(execGRASS("g.findfile", element="cell", file="slope",
>       mapset="'.'", intern=TRUE), silent=TRUE)
> ifelse(class(oo) == "try-error", FALSE, TRUE)
>
> and use intern to capture the output if the file exists.

Thank you very much, this was exactly what solved the issue.

Best regards,
Christian



-- 
Dr. Christian Willmes	
AG GIS & Fernerkundung      | GIS & RS Group
Geographisches Institut     | Institute of Geography
Universität zu Köln         | University of Cologne
Tel.: +49 (0)221 470 6234
http://www.geographie.uni-koeln.de/14126.html
http://www.sfb806.de
http://crc806db.uni-koeln.de
http://publons.com/a/1316706/
http://orcid.org/0000-0002-5566-6542



More information about the R-sig-Geo mailing list