Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot deal with SAGA installation from OSGEO4W #15

Open
ottadini opened this issue Aug 18, 2021 · 10 comments
Open

cannot deal with SAGA installation from OSGEO4W #15

ottadini opened this issue Aug 18, 2021 · 10 comments

Comments

@ottadini
Copy link

On Windows, a common means to install SAGA is through the OSGEO4W package installer, which is mostly an installer for QGIS. This package runs its binaries in a special environment managed through a bunch of batch files.

When saga_cmd.exe is run outside of the environment, it fails to find the required dependencies because PATH and other environment variables have not been correctly set. Is there any chance in Lytton that this env could be set through Rsagacmd's saga_env?

The workaround is to install a separate SAGA-GIS install.

@stevenpawley
Copy link
Owner

Thanks for this suggestion - I'll add the typical OSGEO4W path to SAGA's search path

@ottadini
Copy link
Author

Careful with that though, as the SAGA binary won't be able to find many of the required dlls it needs to run, unless you also somehow set the environment variables correctly. Perhaps all you need to do is set PATH="%PATH%;%OSGEO4W_ROOT%\bin" for each saga_cmd session? That's where the supporting dlls seem to be, though can't guarantee that there aren't other files elsewhere.

@davidrice3
Copy link

davidrice3 commented Nov 22, 2022

I just downloaded QGIS but there was not a separate option in the installation wizard to download SAGA as an additional plugin. After installing SAGA-GIS I still don't know what code to use to get R connected to SAGA...path etc. Can someone here help? Thank you!!!!

image

@stevenpawley
Copy link
Owner

There is no support for the OSGEO4W version of SAGA - if you install the standalone version from the SAGA developers (binaries available for windows from sourceforge) then the saga_gis command should fine it if you install it in one of the standard locations shown in here https://stevenpawley.github.io/Rsagacmd/reference/search_saga.html. Alternatively, add the directory containing saga_cmd.exe to PATH.

@davidrice3
Copy link

davidrice3 commented Nov 23, 2022

Thank you Steven, the search_saga() does not work either. I get this result...Rsagacmd is up and running.
image

@davidrice3
Copy link

Oh search_saga works....just need to leave of the ()

@davidrice3
Copy link

davidrice3 commented Nov 23, 2022

It still cannot find it...I'm getting this msg...is there something wrong with the path I'm using?...
The problem line is below, but I just can't figure out what the actual problem is.
saga = saga_gis(raster_backend = "terra", vector_backend = "sf")

image

@stevenpawley
Copy link
Owner

Either add the folder that contains the saga_cmd.exe, i.e., "C:/Program Files/saga-8.4.1_x64" to your user or system environment variable 'Path' and then Rsagacmd will know where it is located. Alternatively, you can do it manually every time you initiate the bridge to SAGA by:

saga = saga_gis(
  saga_bin = "C:/Program Files/saga-8.4.1_x64/saga_cmd.exe",
  raster_backend = "terra",
  vector_backend = "sf"
)

@Pang-SEH
Copy link

Still relatively new to issue reporting, so apologies in advance if this post lacks details.
Installed SAGA through OSGeo4W. I am unable to connect to SAGA. When I input the command below it returns an error on unable to check SAGA's version.

saga <- saga_gis(saga_bin = 'C:/OSGeo4W/apps/saga/saga_cmd.exe', raster_backend = 'terra')
Error in if (saga_vers > as.numeric_version("3.0.0")) { :
argument is of length zero
In addition: Warning message:
In system(paste(shQuote(saga_cmd), "--version"), intern = T) :
running command '"C:/OSGeo4W/apps/saga/saga_cmd.exe" --version' had status 309

Unsure if this is related to what @ottadini mentioned as there isn't an error on dependencies. I really like the concept of this package and would really like to use it for a huge data pipeline as I am mostly familiar with working in R.

@stevenpawley
Copy link
Owner

Hello, thanks for yes. You are right that this is still the same issue. I always installed SAGA-GIS as a standalone software, probably because for a long time, the QGIS version was many versions behind. However, perhaps more people are using SAGA via OSGEO now. I'll try to look into it - the installation of SAGA through OSGEO is different and probably needs some environment variables setting first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants