r-spatial / RQGIS3

GNU Lesser General Public License v3.0
69 stars 19 forks source link

Connecting to OTB #18

Open ailich opened 4 years ago

ailich commented 4 years ago

The paper on RQGIS mentions the ability to connect with the Orfeo Toolbox. qgis_session_info() shows connections to qgis, gdal grass6, grass7, and saga, but not OTB. Is connecting to OTB currently supported?

pat-s commented 4 years ago

IIRC OTB was removed from QGIS3?

ailich commented 4 years ago

@pat-s, it was removed initially, but as of QGIS 3.8, it was added back in. Currently my QGIS installation is located in "C:/OSGEO4W" folder, and the Orfeo toolbox is located in "C:\OTB-7.0.0-Win64."

pat-s commented 4 years ago

Thanks for the heads up!

AFAIR we removed the support for OTB back then when it was removed. Should be an easy one to add it back in if nothing major has changed meanwhile.

@jannes-m?

ailich commented 4 years ago

@pat-s cool. Would the OTB folder need to "live" in a specific place and be named a certain way to be detected by RQGIS/RQGIS3?

jannes-m commented 4 years ago

This would only work if OTB is part of the processing toolbox (as it was in QGIS 2) but I think I remember that they wanted to add other 3rd party providers as plugins. If this is the case I would rather refrain from adding an additional dependency since (R)QGIS3 is already hard to maintain. Instead I would simply use the command line interface of OTB which you could easily use via system() calls in R. But you can test, if OTB algorithms are available (assuming that you also have installed OTB on your system) by running:

library("RQGIS3")
set_env()
algs = find_algorithms(name_only = TRUE)
# check if otb is among the 3rd party providers
unique(gsub(":.*", "", algs))
ailich commented 4 years ago

@jannes-m OTB does show up in the Processing Toolbox after following the instructions here (see image). However, it does not show up as a 3rd party provider for RQGIS3. It may be related to my setup though because I cannot get RQGIS to find it either even though it appears in the processing toolbar when QGIS2 is open.

Capture

library("RQGIS3")
set_env()
algs = find_algorithms(name_only = TRUE)
# check if otb is among the 3rd party providers
unique(gsub(":.*", "", algs))
[1] "gdal"   "grass7" "native" "qgis"   "saga"  
library("RQGIS")
set_env("C:/Program Files/QGIS 2.18")
algs = find_algorithms(name_only = TRUE)
# check if otb is among the 3rd party providers
unique(gsub(":.*", "", algs))
[1] "taudem"       "modelertools" "qgis"         "grass7"       "lidartools"   "saga"        
[7] "gdalogr"      "gdalorg"      "grass"