Menu

delete records from point-shape

User Forum
Karin
2017-03-16
2017-03-16
  • Karin

    Karin - 2017-03-16

    I have a batch file with saga commands (saga 2.1.4) to delete records from the shape.
    My first step:
    table_calculus 2 create a new field "G", if my condition is fulfilled then value = 1 otherwize value = 9,. It works.
    now I want delete all records where G=0
    I use "shapes_tools 3 ..." and in the cmd window is shown, that 34 records are selected
    next:
    shapes_tools 7 (delete selected records)
    now the message is: no shapes in selection

    is it possible to use these orders in the batch file?

     
  • Volker Wichmann

    Volker Wichmann - 2017-03-16

    Hi Karin,

    in a normal batch file it is not possible to work on selections - how should it be possible to pass the selection information from one saga_cmd call to the next?

    But for such cases saga_cmd provides the option to use something that is called "saga cmd script file":

    saga_cmd --help
    ...
    <SCRIPT>         : saga cmd script file with one or more tool calls
    ...
    

    Such a script file can be passed directly to saga_cmd :

    saga_cmd [-C, --config][=#][-s, --story][=#][-c, --cores][=#][-f, --flags][=#] <SCRIPT>
    

    You can create an example of such a script (and a batch file calling the script) with

    saga_cmd --create-batch[=file]
       creates a batch script file example.
    

    Called without "file" argument, this outputs a file called "saga_cmd.bat" which is a batch file as you use it. And a file called "saga_cmd.txt" which is the saga cmd script file. The latter is called from the batch file.

    So all you need to do is to wrap your command sequence in such a saga cmd script file. Please note that I just fixed a small issue regarding the file name of the script file in the example (saga_cmd.bat), see https://sourceforge.net/p/saga-gis/code/ci/11156806d08169d8d4e4cce81ffed3e76334bb25/

    regards,
    Volker

    --
    http://www.laserdata.at
    http://www.alp-s.at/cms/en/

     

Log in to post a comment.