[R-sig-Geo] error to extract soil grids data

Mª Eliza Turek m@r|@e||z@turek @end|ng |rom gm@||@com
Mon May 6 18:15:54 CEST 2019


Dear all,

 I need to extract texture and bulk density data for Brazil, in order to
convert it to soil hydraulic parameters using PTF functions. I read in soil
grids website that for this kind of evaluation is better to use "tile"
data. How can I perform that? I Couldn't find a manual for that. (I can't
access http://gsif.isric.org/doku.php?id=wiki:tutorial_soilgrid).
Also, I am starting to use soil grids and found an error that seems to be
very easy but it stopped my work. It seems to be something referent to the
tiff image. I am trying to use the following code, but after the last
command I get the error: Error in .local(.Object, ...) :
 MissingRequired:TIFF directory is missing required "StripByteCounts" field

Can anyone help me? Thank you!

> # SoilGrids tutorial
> # Reference: [http://gsif.isric.org/doku.php?id=wiki:tutorial_soilgrids]
> # Tom.Hengl using isric.org
> rm(list=ls())
> library(RCurl)
Loading required package: bitops
> library(rgdal)
Loading required package: sp
rgdal: version: 1.4-3, (SVN revision 828)
 Geospatial Data Abstraction Library extensions to R successfully loaded
 Loaded GDAL runtime: GDAL 2.2.3, released 2017/11/20
 Path to GDAL shared files:
C:/Users/User/Documents/R/win-library/3.5/rgdal/gdal
 GDAL binary built with GEOS: TRUE
 Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
 Path to PROJ.4 shared files:
C:/Users/User/Documents/R/win-library/3.5/rgdal/proj
 Linking to sp version: 1.3-1
> library(GSIF)
GSIF version 0.5-5 (2019-01-04)
URL: http://gsif.r-forge.r-project.org/
> library(raster)
> library(plotKML)
plotKML version 0.5-9 (2019-01-04)
URL: http://plotkml.r-forge.r-project.org/
> library(XML)
> library(lattice)
> library(aqp)
This is aqp 1.17

Attaching package: ‘aqp’

The following objects are masked from ‘package:raster’:

    metadata, metadata<-, union

The following object is masked from ‘package:base’:

    union

> library(soiltexture)
soiltexture 1.5.1 (git revision: 4b25ba2). For help type:
help(pack='soiltexture')
> ## GDAL paths:
> if(.Platform$OS.type == "windows"){
+   gdal.dir <- shortPathName("C:/Program files/GDAL")
+   gdal_translate <- paste0(gdal.dir, "/gdal_translate.exe")
+   gdalwarp <- paste0(gdal.dir, "/gdalwarp.exe")
+   gdalinfo <- paste0(gdal.dir, "/gdalinfo.exe")
+ } else {
+   gdal_translate = "gdal_translate"
+   gdalwarp = "gdalwarp"
+   gdalinfo = "gdalinfo"
+ }
> ## (a) FTP download:
> ## location of soilgrids:
> sg.ftp <- "ftp://ftp.soilgrids.org/data/recent/"
> filenames = getURL(sg.ftp, ftp.use.epsv = FALSE, dirlistonly = TRUE)
> filenames = strsplit(filenames, "\r*\n")[[1]]
> filenames[1:5]
[1] "ACDWRB_M_ss_250m.tif" "ACDWRB_M_ss_250m.xml" "AWCh1_M_sl1_250m.tif"
"AWCh1_M_sl1_250m.xml" "AWCh1_M_sl2_250m.tif"
> ## download to a local directory:
> ORC.name <- filenames[grep(filenames,
pattern=glob2rx("AWCh2_M_sl2_250m.tif$"))]
> ORC.name
[1] "AWCh2_M_sl2_250m.tif"
> try(download.file(paste(sg.ftp, ORC.name, sep=""), ORC.name))
trying URL 'ftp://ftp.soilgrids.org/data/recent/AWCh2_M_sl2_250m.tif'
downloaded 919.3 MB

> ## check that everything is OK:
> GDALinfo(ORC.name)
Error in .local(.Object, ...) :
  MissingRequired:TIFF directory is missing required "StripByteCounts" field
---------------------------------------------------------------------



-- 
Maria Eliza Turek
PhD Student - Graduate Program of Environmental Engineering  - PPGEA
Federal University of Paraná - UFPR

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list