Closed tylerbhampton closed 5 years ago
This works for me under Windows:
library("RQGIS3")
#> Loading required package: reticulate
# show session info
qgis_session_info()
#> Trying to find QGIS in C:/OSGEO4~1
#> $gdal
#> [1] "2.4.1"
#>
#> $grass7
#> [1] FALSE
#>
#> $qgis_version
#> [1] "3.4.7-Madeira"
#>
#> $saga
#> [1] "2.3.2"
# fill sinks
run_qgis(alg = "saga:fillsinks",
DEM = dem,
RESULT = file.path(tempdir(), "dem_fill.sdat"),
load_output = FALSE)
#> NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
#> NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
#> NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
#> $RESULT
#> [1] "C:/Users/janne/AppData/Local/Temp/Rtmp8ASjgc/dem_fill.sdat"
# run watershed analysis
out = run_qgis(alg = "grass7:r.watershed",
elevation = file.path(tempdir(), "dem_fill.sdat"),
threshold = 100,
accumulation = file.path(tempdir(), "acc.tif"),
drainage = file.path(tempdir(), "flowdir.tif"),
load_output = TRUE)
#> $accumulation
#> [1] "C:/Users/janne/AppData/Local/Temp/Rtmp8ASjgc/acc.tif"
#>
#> $basin
#> NULL
#>
#> $drainage
#> [1] "C:/Users/janne/AppData/Local/Temp/Rtmp8ASjgc/flowdir.tif"
#>
#> $half_basin
#> NULL
#>
#> $length_slope
#> NULL
#>
#> $slope_steepness
#> NULL
#>
#> $spi
#> NULL
#>
#> $stream
#> NULL
#>
#> $tci
#> NULL
#> NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
#> NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
out
#> $accumulation
#> class : RasterLayer
#> dimensions : 117, 117, 13689 (nrow, ncol, ncell)
#> resolution : 30.85, 30.85 (x, y)
#> extent : 794599.1, 798208.6, 8931775, 8935384 (xmin, xmax, ymin, ymax)
#> coord. ref. : +proj=utm +zone=17 +south +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0
#> data source : C:/Users/janne/AppData/Local/Temp/Rtmp8ASjgc/acc.tif
#> names : acc
#> attributes :
#> ID min max redmin redmax greenmin greenmax bluemin
#> from: 0 67.90281 278.0238 0 0 0 0 255
#> to : 9 -5998.18171 -278.0238 0 0 0 0 0
#> bluemax
#> 0
#> 0
#>
#>
#> $drainage
#> class : RasterLayer
#> dimensions : 117, 117, 13689 (nrow, ncol, ncell)
#> resolution : 30.85, 30.85 (x, y)
#> extent : 794599.1, 798208.6, 8931775, 8935384 (xmin, xmax, ymin, ymax)
#> coord. ref. : +proj=utm +zone=17 +south +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0
#> data source : C:/Users/janne/AppData/Local/Temp/Rtmp8ASjgc/flowdir.tif
#> names : flowdir
#> values : -32768, 32767 (min, max)
#> attributes :
#> ID min max redmin redmax greenmin greenmax bluemin bluemax
#> 0 0 8 255 0 255 0 255 0
#> 1 -8 0 0 255 0 255 0 255
Created on 2019-05-14 by the reprex package (v0.2.1)
Please note that you are not using the latest QGIS LTR which is 3.4.7. I don't know what you mean that you use Anaconda Python. QGIS ships with its own Python binary under Windows and this is what your output is also saying (C:/OSGeo4W64/bin/python3.exe
). Please make also sure that your OSGeo installation also installed GRASS GIS.
Jannes thanks so much again for your help. Yes, I reinstalled OSGeo, with latest QGIS LTR 3.4.7 and python3 and GRASS GIS. Worked great. It seems the problems I've been having are with the OSGeo installer, since you have to manually configure the custom install. Do you have a list somewhere of all the required components needed to properly have your package work?
To rewrite the installation_guide
vignette is on my to-do list!
I used OSGeo to install the most recent ltr QGIS version and Anaconda to install python. I've had lots of problems getting this example to work and this time I'm getting a python error:
Full code below: