Open sugizo opened 1 month ago
Hello!
PySAGA-cmd is just a Python wrapper around the command line interface of SAGA GIS. You might want to repost your issue on the official SAGA GIS repository https://github.com/saga-gis/saga-gis.
I will still give you my personal opinion on this, though. SAGA GIS does not support read/write operations on TIN files, so you can not save the "Grid to TIN" output locally. If you will look inside the generated DEM_30m.shp you will see that it is a point vector. Your workflow works when you try with saga_gui because SAGA GIS has some way of handling TIN files inside the GUI application, but not inside the command line interface.
I think you can still make this happen through the command line interface if you create a toolchain. There are some toolchain resources online which could help you get started. After you create and import the toolchain xml file, you can use it with the command line interface and automate your workflows.
If you have any more questions, let me know!
thanks for suggestion, already tried it but imo it's nonsense,
better use saga_cmd like my first post, because can pass parameter value while in toolchain xml, the values is vagued
e.g.
<?xml version="1.0" encoding="UTF-8"?>
<toolchain saga-version="8.5.0">
<group>toolchains</group>
<identifier>tes</identifier>
<name>tes</name>
<description>created from history</description>
<parameters>
<input varname="tool_01__VALUES" type="grid_list">
<name>Values</name>
</input>
<input varname="tool_01__GRID" type="grid">
<name>Grid</name>
</input>
<output varname="tool_01__TIN" type="tin">
<name>TIN</name>
</output>
</parameters>
<tools>
<tool library="tin_tools" tool="0" name="Grid to TIN">
<output id="TIN">tool_01__TIN</output>
<input id="GRID">tool_01__GRID</input>
<input id="VALUES">tool_01__VALUES</input>
</tool>
</tools>
</toolchain>
the problem is during the last command on my first post :
saga_cmd io_shapes 12 -TIN DEM_30m.shp -ZFIELD 'DEM_30m' -BINARY 1 -FILE DEM_30m
already tried from inside python script too, again same like first post, the last command produce 0 file size e.g.
file_name = 'DEM_30m'
path = f'/usr/local/lib/python3.10/dist-packages/PySAGA_cmd/assets/{file_name}.tif'
io_gdal_0 = saga / 'io_gdal' / 0
output_0 = io_gdal_0.execute(files = path, grids = file_name, ignore_stderr = True, verbose = True)
print(output_0.stdout)
tin_tools_0 = saga / 'tin_tools' / 0
output_1 = tin_tools_0.execute(grid = f'{file_name}.sgrd', values = f'{file_name}.sgrd', tin = f'{file_name}_0', ignore_stderr = True, verbose = True)
print(output_1.stdout)
io_shapes_0 = saga / 'io_shapes' / 12
output_1_1 = io_shapes_0.execute(tin = f'{file_name}_0.shp', zfield = f'{file_name}_0', binary = 1, file = f'{file_name}.stl', ignore_stderr = True, verbose = True)
print(output_1_1.stdout)
best regards
env google colab os : ubuntu jammy (x64)
steps
result not expected, output DEM_30m.stl 0 byte
expected result can have *.stl output that can be view or open, like execute from
saga_gui