checkign accuracy of interpolation, copy selection to new layer

User Forum
john
2013-11-09
2013-12-09
  • john

    john - 2013-11-09

    My end goal is to run a krige interpolation, then remove an input point and run it again and check what the grid value is at the missing point location. So to do this, I was going to select the point I want to remove, copy it to a new layer, then delete it from the original layer. The geoproccessor seems to select the desired point, but when I try to copy it to a new layer it causes saga_cmd.exe to crash. Also deleting the selection fails which is in the second block below.

    > myenv 
    $workspace
    [1] "."
    
    $cmd
    [1] "saga_cmd.exe"
    
    $path
    [1] "C:/Program Files/SAGA-GIS"
    
    $modules
    [1] "C:/Program Files/SAGA-GIS/modules"
    
    $version
    [1] "2.0.8"
    
    $cores
    [1] NA
    
    $parallel
    [1] FALSE
    
    $lib.prefix
    [1] ""
    
    > #### SELECT By attribute
    > rsaga.geoprocessor(lib="shapes_tools", module=4, env=myenv, param=list(
    +     SHAPES="selectedData.shp",
    +     FIELD="STATION",
    +     EXPRESSION="ABERDEEN REGIONAL AIRPORT SD US"))
    
    library path:   C:\PROGRA~1\SAGA-GIS\modules
    library name:   shapes_tools
    module name :   Select by Attributes... (String Expression)
    author      :   V.Olaya (c) 2004, O.Conrad (c) 2011
    
    Load shapes: selectedData.shp...
    ready
    
    Parameters
    
    Shapes: selectedData
    Attribute: STATION
    Expression: ABERDEEN REGIONAL AIRPORT SD US
    Case Sensitive: no
    Select if...: attribute contains search expression
    Method: new selection
    
    selected shapes: 1
    > #### Copy selection to new layer
    > rsaga.geoprocessor(lib="shapes_tools", module=6, env=myenv, param=list(
    +     INPUT="selectedData.shp",
    +     OUTPUT="randomStation.shp"))
    
    Warning message:
    running command '"C:/Program Files/SAGA-GIS/saga_cmd.exe" shapes_tools 6 -INPUT "selectedData.shp" -OUTPUT "randomStation.shp"' had status 5 
    > 
    

    Then when I try to delete the selection from the original shape (after re-selecting) it doesn't crash but says:

    > #### SELECT By attribute
    > rsaga.geoprocessor(lib="shapes_tools", module=4, env=myenv, param=list(
    +     SHAPES="selectedData.shp",
    +     FIELD="STATION",
    +     EXPRESSION="ABERDEEN REGIONAL AIRPORT SD US"))
    
    library path:   C:\PROGRA~1\SAGA-GIS\modules
    library name:   shapes_tools
    module name :   Select by Attributes... (String Expression)
    author      :   V.Olaya (c) 2004, O.Conrad (c) 2011
    
    Load shapes: selectedData.shp...
    ready
    
    Parameters
    
    Shapes: selectedData
    Attribute: STATION
    Expression: ABERDEEN REGIONAL AIRPORT SD US
    Case Sensitive: no
    Select if...: attribute contains search expression
    Method: new selection
    
    selected shapes: 1
    > #### delete selection
    > rsaga.geoprocessor(lib="shapes_tools", module=7, env=myenv, param=list(
    +     INPUT="selectedData.shp"))
    
    library path:   C:\PROGRA~1\SAGA-GIS\modules
    library name:   shapes_tools
    module name :   Delete Selection from Shapes Layer
    author      :   O.Conrad (c) 2011
    
    Load shapes: selectedData.shp...
    ready
    
    Parameters
    
    Input: selectedData
    
    error: no shapes in selection
    
    error: executing module [Delete Selection from Shapes Layer]
    Warning message:
    running command '"C:/Program Files/SAGA-GIS/saga_cmd.exe" shapes_tools 7 -INPUT "selectedData.shp"' had status 1 
    > 
    
     
    Last edit: john 2013-11-09
  • Volker Wichmann

    Volker Wichmann - 2013-11-10

    I'm not very familiar with the rsaga.geoprocessor, but since it is calling saga_cmd I don't think that this can be made working. saga_cmd does not support the selection of items - each call to saga_cmd is a separate process, so it is not possible to pass the selection information from one module call to the next. Such functionality is only supported in case you use the SAGA Python API for scripting.

     
  • john

    john - 2013-11-11

    OK, thanks. I can do these things on the data frame before creating the shapes I guess.

     
  • Volker Wichmann

    Volker Wichmann - 2013-12-09

    Just as a follow up - I oversaw that in the meatime saga_cmd is able to not only call a single module but also a complete script. This allows to perform selections. You can create an example with the following call:

    saga_cmd --batch
    

    This will create a script using saga_cmd and a text file (with additional saga_cmd calls) which is then called from the script to perform a selection.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks