This forum is shutting down! Please post new discussions at community.naturalcapitalproject.org

Using InVEST from command line

alexsalexs Member
As I understand, InVEST can be used from ArcGIS and as standalone tools with GUI. Is is possible to run InVEST from command line? For example this can be useful for creating batch files or intergrating InVEST with other software

Comments

  • jdouglassjdouglass Administrator, NatCap Staff
    Hi @alexs,

    I can definitely see how this would be useful to have!  The GUIs themselves can be launched from the command-line, but unfortunately the UI values cannot be set through command-line parameters.  Executables are located at C:\InVEST_<version>\invest-3-x86\*.exe, if that's helpful, but as I mentioned, these executables co not currently accept command-line parameters.

    The best way to do this at the moment would be to install our python package of InVEST models and to write a script to run the target models with the parameters you're looking for.  There's more information about this approach on our wiki page on the subject: https://code.google.com/p/invest-natcap/wiki/ScriptingInVESTOnWindows

    James
  • alexsalexs Member
    Thanks for prompt reply, James!

    Yes, I found executables and even tried to run them from command line before posting here.

    As I understand from the link you gave me, before using all models it is necessary to run them via GUI, set parameters and generate Python scripts from them. This scripts later can be altered to use another parameters. Will try to use this approach and come back with results.

    Thanks again for your help!
  • jdouglassjdouglass Administrator, NatCap Staff
    Sure thing!

    The script-generation functionality of the UI is really just for convenience ... it's just there to give you an example of how the model would be called from a python interpreter when given the inputs defined in the current state of the UI.  If you write a python script that imports and calls the appropriate model with a dictionary of parameters, the model should execute.

    The thing to remember is that all of this would be happening within the python interpreter, so you'll still have to set up your python stack (python, numpy, scipy, cython, etc.) to be able to install our invest python package and execute the script.

    Hope this helps, and let us know how it goes!
Sign In or Register to comment.