accessing in_memory workspace in bat/python

User Forum
George
2011-09-15
2012-07-20
  • George

    George - 2011-09-15

    Hi,

    I want to run the following two commands in the in_memory workspace but can't
    seem to crack the code...

    @ECHO OFF
    
    SET SAGA_MLB = C:\SAGA\Modules
    SET PATH = %PATH%;C:\SAGA
    
    ECHO %1 %2 %3
    
    PAUSE
    

    C:\SAGA\saga_cmd io_shapes_las "Import LAS Files" -POINTS=
    -FILE=%3\%1_1K_class.las -T -i -a -r -c -u -n -R -G -B -e -d -p -C -VALID
    -RGB_RANGE=0

    PAUSE

    ECHO %1 %2

    ECHO %2\%1_fc.shp

    PAUSE

    c:\SAGA\saga_cmd pointcloud_tools "Point Cloud to Shapes" -POINTS=
    -SHAPES=%2\%1_fc.shp

    PAUSE

    This is called from a python script that also used arcpy

     
  • Volker Wichmann

    Volker Wichmann - 2011-09-15

    In case the code you posted is complete (please "Codify" the complete script),
    I'm wondering why you leave the -POINTS parameter(s) empty. For the LAS import
    it must be set to the .spc output filename and with the PC2SHP module it is
    the input file.

    Volker

     
  • Johan Van de Wauw

    Using batch it is impossible to keep things in memory. It can not do that. If
    you want that you will have to use python.

     
  • Anonymous - 2011-09-16

    @ recklov_w . Sorry about not codifying the script. I left the -POINTS blank
    as I wanted it in memory and then for the point cloud to shp process to use
    that. Does the argis concept of in_memory work in SAGA. When I set spc
    output/input I get a access violation error. See attached
    image

    @johanvdw - I am processing both SAGA commands in the same bat process,
    wouldn't this then keep it in memory? I have been trying to run the saga_api
    in python but can't get the

    [quote]
    
     File "C:\Python26\ArcGIS10.0\Lib\site-packages\saga_api_examples\01_grid_asc_to_saga.py", line 8, in grid_asc2sgrd
        fmlb    = os.environ ['SAGA']+'/modules/io_grid.dll' # Win[/quote]dows
    
    to work. I have c:\SAGA in my path. What else is needed.
    
     
  • Johan Van de Wauw

    1) batch can not keep things in memory ever. All you can do is run programs
    after eachother.

    2) try editing the scriptfile and instead of using os.environ try typing the
    full path to the .dll file.

    3) I'll try to make a script tonight/this weekend with some more
    documentation. Being able to keep things in memory in a script is indeed very
    useful, and I think a sample demonstrating how to do this would be usefsul for
    other situations as well.

     

Log in to post a comment.