Skip to main content
deleted 30 characters in body
Source Link
Kadir Şahbaz
  • 78k
  • 57
  • 257
  • 404

I am building a QGIS model to perform field calculations on a large number of .shp files containing environmental information of different waterbodies. This model should be global for the different waterbodies I am working with where one model run is performed for each waterbody. The waterbodies are specified in the filenames of the .shp files as a two-letter code (e.g., VF = Vejle Fjord).

The field calculator operations are getting input vector layers from an input folder containing the .shp files following a file path below:

C:/Users/lees/OneDrive - Syddansk Universitet/Projects/QGIS Projects/GradientAnalysisModel/GIS_files/Model_input/GSmax_EN_VF_B.shp

C:/Users/lees/OneDrive - Syddansk Universitet/Projects/QGIS Projects/GradientAnalysisModel/GIS_files/Model_input/GSmax_EN_VF_B.shp

My question is: Can I use a string input in the model builder to specify the waterbody code I want to use for the model and replace the waterbody code in the file paths used in the field calculators as below? This is so that I can specify which waterbody I use as input by typing the waterbody code in the model execution window.

Original file path:

C:/Users/lees/OneDrive - Syddansk Universitet/Projects/QGIS Projects/GradientAnalysisModel/GIS_files/Model_input/GSmax_EN_VF_B.shp

C:/Users/lees/OneDrive - Syddansk Universitet/Projects/QGIS Projects/GradientAnalysisModel/GIS_files/Model_input/GSmax_EN_VF_B.shp

Replaces file path using string input called WB_code:

C:/Users/lees/OneDrive - Syddansk Universitet/Projects/QGIS Projects/GradientAnalysisModel/GIS_files/Model_input/GSmax_EN_@WB_code_B.shp

Hope it all makes sense.

Best, Mikkel

C:/Users/lees/OneDrive - Syddansk Universitet/Projects/QGIS Projects/GradientAnalysisModel/GIS_files/Model_input/GSmax_EN_@WB_code_B.shp

I am building a QGIS model to perform field calculations on a large number of .shp files containing environmental information of different waterbodies. This model should be global for the different waterbodies I am working with where one model run is performed for each waterbody. The waterbodies are specified in the filenames of the .shp files as a two-letter code (e.g., VF = Vejle Fjord).

The field calculator operations are getting input vector layers from an input folder containing the .shp files following a file path below:

C:/Users/lees/OneDrive - Syddansk Universitet/Projects/QGIS Projects/GradientAnalysisModel/GIS_files/Model_input/GSmax_EN_VF_B.shp

My question is: Can I use a string input in the model builder to specify the waterbody code I want to use for the model and replace the waterbody code in the file paths used in the field calculators as below? This is so that I can specify which waterbody I use as input by typing the waterbody code in the model execution window.

Original file path:

C:/Users/lees/OneDrive - Syddansk Universitet/Projects/QGIS Projects/GradientAnalysisModel/GIS_files/Model_input/GSmax_EN_VF_B.shp

Replaces file path using string input called WB_code:

C:/Users/lees/OneDrive - Syddansk Universitet/Projects/QGIS Projects/GradientAnalysisModel/GIS_files/Model_input/GSmax_EN_@WB_code_B.shp

Hope it all makes sense.

Best, Mikkel

I am building a QGIS model to perform field calculations on a large number of .shp files containing environmental information of different waterbodies. This model should be global for the different waterbodies I am working with where one model run is performed for each waterbody. The waterbodies are specified in the filenames of the .shp files as a two-letter code (e.g., VF = Vejle Fjord).

The field calculator operations are getting input vector layers from an input folder containing the .shp files following a file path below:

C:/Users/lees/OneDrive - Syddansk Universitet/Projects/QGIS Projects/GradientAnalysisModel/GIS_files/Model_input/GSmax_EN_VF_B.shp

My question is: Can I use a string input in the model builder to specify the waterbody code I want to use for the model and replace the waterbody code in the file paths used in the field calculators as below? This is so that I can specify which waterbody I use as input by typing the waterbody code in the model execution window.

Original file path:

C:/Users/lees/OneDrive - Syddansk Universitet/Projects/QGIS Projects/GradientAnalysisModel/GIS_files/Model_input/GSmax_EN_VF_B.shp

Replaces file path using string input called WB_code:

C:/Users/lees/OneDrive - Syddansk Universitet/Projects/QGIS Projects/GradientAnalysisModel/GIS_files/Model_input/GSmax_EN_@WB_code_B.shp

Source Link

Using an input string in a file path for a input vector layer in QGIS model

I am building a QGIS model to perform field calculations on a large number of .shp files containing environmental information of different waterbodies. This model should be global for the different waterbodies I am working with where one model run is performed for each waterbody. The waterbodies are specified in the filenames of the .shp files as a two-letter code (e.g., VF = Vejle Fjord).

The field calculator operations are getting input vector layers from an input folder containing the .shp files following a file path below:

C:/Users/lees/OneDrive - Syddansk Universitet/Projects/QGIS Projects/GradientAnalysisModel/GIS_files/Model_input/GSmax_EN_VF_B.shp

My question is: Can I use a string input in the model builder to specify the waterbody code I want to use for the model and replace the waterbody code in the file paths used in the field calculators as below? This is so that I can specify which waterbody I use as input by typing the waterbody code in the model execution window.

Original file path:

C:/Users/lees/OneDrive - Syddansk Universitet/Projects/QGIS Projects/GradientAnalysisModel/GIS_files/Model_input/GSmax_EN_VF_B.shp

Replaces file path using string input called WB_code:

C:/Users/lees/OneDrive - Syddansk Universitet/Projects/QGIS Projects/GradientAnalysisModel/GIS_files/Model_input/GSmax_EN_@WB_code_B.shp

Hope it all makes sense.

Best, Mikkel