0

In QGIS modeler I have added an input CSV but can only connected to files open in the workspace. How do I get it to connect to the input file like https://gis.stackexchange.com/a/291183/2891

Input enter image description here

Extract / or Selection doesn't allow me to choose the Input file...but lists the tables open in the workspace. enter image description here

UPDATE When I change the input layer to 'Using model input' I don't get any options in the drop down. Have I defined my input wrong? enter image description here

Here's my .model3 code

<!DOCTYPE model>
<Option type="Map">
  <Option name="children" type="Map">
    <Option name="native:fieldcalculator_1" type="Map">
      <Option value="true" name="active" type="bool"/>
      <Option name="alg_config"/>
      <Option value="native:fieldcalculator" name="alg_id" type="QString"/>
      <Option value="" name="color" type="QString"/>
      <Option name="comment" type="Map">
        <Option value="" name="color" type="QString"/>
        <Option value="" name="component_description" type="QString"/>
        <Option value="60" name="component_height" type="double"/>
        <Option value="320" name="component_pos_x" type="double"/>
        <Option value="115" name="component_pos_y" type="double"/>
        <Option value="100" name="component_width" type="double"/>
        <Option value="true" name="outputs_collapsed" type="bool"/>
        <Option value="true" name="parameters_collapsed" type="bool"/>
      </Option>
      <Option value="Field calculator" name="component_description" type="QString"/>
      <Option value="30" name="component_height" type="double"/>
      <Option value="304.5" name="component_pos_x" type="double"/>
      <Option value="216.5" name="component_pos_y" type="double"/>
      <Option value="200" name="component_width" type="double"/>
      <Option name="dependencies"/>
      <Option value="native:fieldcalculator_1" name="id" type="QString"/>
      <Option name="outputs" type="Map">
        <Option name="PCL_v1" type="Map">
          <Option value="native:fieldcalculator_1" name="child_id" type="QString"/>
          <Option value="" name="color" type="QString"/>
          <Option name="comment" type="Map">
            <Option value="" name="color" type="QString"/>
            <Option value="" name="component_description" type="QString"/>
            <Option value="60" name="component_height" type="double"/>
            <Option value="0" name="component_pos_x" type="double"/>
            <Option value="0" name="component_pos_y" type="double"/>
            <Option value="100" name="component_width" type="double"/>
            <Option value="true" name="outputs_collapsed" type="bool"/>
            <Option value="true" name="parameters_collapsed" type="bool"/>
          </Option>
          <Option value="PCL_v1" name="component_description" type="QString"/>
          <Option value="58" name="component_height" type="double"/>
          <Option value="459.5" name="component_pos_x" type="double"/>
          <Option value="325.5" name="component_pos_y" type="double"/>
          <Option value="200" name="component_width" type="double"/>
          <Option name="default_value" type="invalid"/>
          <Option value="false" name="mandatory" type="bool"/>
          <Option value="PCL_v1" name="name" type="QString"/>
          <Option value="OUTPUT" name="output_name" type="QString"/>
          <Option value="true" name="outputs_collapsed" type="bool"/>
          <Option value="true" name="parameters_collapsed" type="bool"/>
        </Option>
      </Option>
      <Option value="true" name="outputs_collapsed" type="bool"/>
      <Option value="true" name="parameters_collapsed" type="bool"/>
      <Option name="params" type="Map">
        <Option name="FIELD_LENGTH" type="List">
          <Option type="Map">
            <Option value="2" name="source" type="int"/>
            <Option value="10" name="static_value" type="int"/>
          </Option>
        </Option>
        <Option name="FIELD_NAME" type="List">
          <Option type="Map">
            <Option value="2" name="source" type="int"/>
            <Option value="PCL" name="static_value" type="QString"/>
          </Option>
        </Option>
        <Option name="FIELD_PRECISION" type="List">
          <Option type="Map">
            <Option value="2" name="source" type="int"/>
            <Option value="0" name="static_value" type="int"/>
          </Option>
        </Option>
        <Option name="FIELD_TYPE" type="List">
          <Option type="Map">
            <Option value="2" name="source" type="int"/>
            <Option value="2" name="static_value" type="int"/>
          </Option>
        </Option>
        <Option name="FORMULA" type="List">
          <Option type="Map">
            <Option value="2" name="source" type="int"/>
            <Option value="regexp_substr(&quot;Document Description&quot;,&#xd;&#xa;'^\\d+-v1-\\s?\\d+\\s*(\\d+)')" name="static_value" type="QString"/>
          </Option>
        </Option>
        <Option name="INPUT" type="List">
          <Option type="Map">
            <Option value="2" name="source" type="int"/>
            <Option value="BuildingRegister_Sheet1_e85756d7_267a_45d9_ba22_1524b285e20d" name="static_value" type="QString"/>
          </Option>
        </Option>
      </Option>
    </Option>
    <Option name="qgis:selectbyattribute_1" type="Map">
      <Option value="true" name="active" type="bool"/>
      <Option name="alg_config"/>
      <Option value="qgis:selectbyattribute" name="alg_id" type="QString"/>
      <Option value="" name="color" type="QString"/>
      <Option name="comment" type="Map">
        <Option value="" name="color" type="QString"/>
        <Option value="" name="component_description" type="QString"/>
        <Option value="60" name="component_height" type="double"/>
        <Option value="540" name="component_pos_x" type="double"/>
        <Option value="215" name="component_pos_y" type="double"/>
        <Option value="100" name="component_width" type="double"/>
        <Option value="true" name="outputs_collapsed" type="bool"/>
        <Option value="true" name="parameters_collapsed" type="bool"/>
      </Option>
      <Option value="Select by attribute" name="component_description" type="QString"/>
      <Option value="30" name="component_height" type="double"/>
      <Option value="192.625" name="component_pos_x" type="double"/>
      <Option value="132.875" name="component_pos_y" type="double"/>
      <Option value="200" name="component_width" type="double"/>
      <Option name="dependencies"/>
      <Option value="qgis:selectbyattribute_1" name="id" type="QString"/>
      <Option name="outputs"/>
      <Option value="true" name="outputs_collapsed" type="bool"/>
      <Option value="true" name="parameters_collapsed" type="bool"/>
      <Option name="params" type="Map">
        <Option name="FIELD" type="List">
          <Option type="Map">
            <Option value="2" name="source" type="int"/>
            <Option value="Document Description" name="static_value" type="QString"/>
          </Option>
        </Option>
        <Option name="INPUT" type="List">
          <Option type="Map">
            <Option value="2" name="source" type="int"/>
            <Option value="BuildingRegister_Sheet1_e85756d7_267a_45d9_ba22_1524b285e20d" name="static_value" type="QString"/>
          </Option>
        </Option>
        <Option name="METHOD" type="List">
          <Option type="Map">
            <Option value="2" name="source" type="int"/>
            <Option value="0" name="static_value" type="int"/>
          </Option>
        </Option>
        <Option name="OPERATOR" type="List">
          <Option type="Map">
            <Option value="2" name="source" type="int"/>
            <Option value="7" name="static_value" type="int"/>
          </Option>
        </Option>
        <Option name="VALUE" type="List">
          <Option type="Map">
            <Option value="2" name="source" type="int"/>
            <Option value="'%-v1%'" name="static_value" type="QString"/>
          </Option>
        </Option>
      </Option>
    </Option>
  </Option>
  <Option name="designerParameterValues" type="Map">
    <Option value="G:\Projects\076_Monthly_DCDB_Update\Working\current\input\BuildingRegister.xls" name="BuildingRegister" type="QString"/>
    <Option value="true" name="VERBOSE_LOG" type="bool"/>
    <Option name="native:fieldcalculator_1:PCL_v1" type="QgsProcessingOutputLayerDefinition">
      <Option type="Map">
        <Option name="create_options" type="Map">
          <Option value="System" name="fileEncoding" type="QString"/>
        </Option>
        <Option name="sink" type="Map">
          <Option value="true" name="active" type="bool"/>
          <Option value="1" name="type" type="int"/>
          <Option value="TEMPORARY_OUTPUT" name="val" type="QString"/>
        </Option>
      </Option>
    </Option>
    <Option name="native:fieldcalculator_2:PCL_Blank" type="QgsProcessingOutputLayerDefinition">
      <Option type="Map">
        <Option name="create_options" type="Map">
          <Option value="System" name="fileEncoding" type="QString"/>
        </Option>
        <Option name="sink" type="Map">
          <Option value="true" name="active" type="bool"/>
          <Option value="1" name="type" type="int"/>
          <Option value="TEMPORARY_OUTPUT" name="val" type="QString"/>
        </Option>
      </Option>
    </Option>
    <Option name="native:fieldcalculator_3:survey_temp" type="QgsProcessingOutputLayerDefinition">
      <Option type="Map">
        <Option name="create_options" type="Map">
          <Option value="System" name="fileEncoding" type="QString"/>
        </Option>
        <Option name="sink" type="Map">
          <Option value="true" name="active" type="bool"/>
          <Option value="1" name="type" type="int"/>
          <Option value="G:/Projects/076_Monthly_DCDB_Update/Working/current/scratch/SurveyPlans.TAB" name="val" type="QString"/>
        </Option>
      </Option>
    </Option>
    <Option name="native:mergevectorlayers_1:Updated_Building_List" type="QgsProcessingOutputLayerDefinition">
      <Option type="Map">
        <Option name="create_options" type="Map">
          <Option value="System" name="fileEncoding" type="QString"/>
        </Option>
        <Option name="sink" type="Map">
          <Option value="true" name="active" type="bool"/>
          <Option value="1" name="type" type="int"/>
          <Option value="G:/Projects/076_Monthly_DCDB_Update/Working/current/scratch/Building_List.TAB" name="val" type="QString"/>
        </Option>
      </Option>
    </Option>
  </Option>
  <Option name="groupBoxes"/>
  <Option name="help"/>
  <Option name="modelVariables"/>
  <Option value="" name="model_group" type="QString"/>
  <Option value="model" name="model_name" type="QString"/>
  <Option name="parameterDefinitions" type="Map">
    <Option name="BuildingRegister" type="Map">
      <Option value="0" name="behavior" type="int"/>
      <Option value="G:\Projects\076_Monthly_DCDB_Update\Working\current\input\BuildingRegister.xls" name="default" type="QString"/>
      <Option name="defaultGui" type="invalid"/>
      <Option value="Building Register" name="description" type="QString"/>
      <Option value="" name="extension" type="QString"/>
      <Option value="All Files (*.*)" name="filefilter" type="QString"/>
      <Option value="0" name="flags" type="int"/>
      <Option value="" name="help" type="QString"/>
      <Option name="metadata"/>
      <Option value="BuildingRegister" name="name" type="QString"/>
      <Option value="file" name="parameter_type" type="QString"/>
    </Option>
    <Option name="native:fieldcalculator_1:PCL_v1" type="Map">
      <Option value="true" name="create_by_default" type="bool"/>
      <Option value="-1" name="data_type" type="int"/>
      <Option name="default" type="invalid"/>
      <Option name="defaultGui" type="invalid"/>
      <Option value="PCL_v1" name="description" type="QString"/>
      <Option value="0" name="flags" type="int"/>
      <Option value="" name="help" type="QString"/>
      <Option name="metadata"/>
      <Option value="native:fieldcalculator_1:PCL_v1" name="name" type="QString"/>
      <Option value="sink" name="parameter_type" type="QString"/>
      <Option value="true" name="supports_append" type="bool"/>
      <Option value="true" name="supports_non_file_outputs" type="bool"/>
    </Option>
  </Option>
  <Option name="parameterOrder"/>
  <Option name="parameters" type="Map">
    <Option name="BuildingRegister" type="Map">
      <Option value="" name="color" type="QString"/>
      <Option name="comment" type="Map">
        <Option value="" name="color" type="QString"/>
        <Option value="" name="component_description" type="QString"/>
        <Option value="60" name="component_height" type="double"/>
        <Option value="320" name="component_pos_x" type="double"/>
        <Option value="15" name="component_pos_y" type="double"/>
        <Option value="100" name="component_width" type="double"/>
        <Option value="true" name="outputs_collapsed" type="bool"/>
        <Option value="true" name="parameters_collapsed" type="bool"/>
      </Option>
      <Option value="BuildingRegister" name="component_description" type="QString"/>
      <Option value="30" name="component_height" type="double"/>
      <Option value="120" name="component_pos_x" type="double"/>
      <Option value="60" name="component_pos_y" type="double"/>
      <Option value="200" name="component_width" type="double"/>
      <Option value="BuildingRegister" name="name" type="QString"/>
      <Option value="true" name="outputs_collapsed" type="bool"/>
      <Option value="true" name="parameters_collapsed" type="bool"/>
    </Option>
  </Option>
</Option>
2

To the left of the input layer dropdown you need to switch from value to model input (third available option). Then you may choose the csv you are inputting, provided you load the csv as vector layer and don't require a geometry on it.

enter image description here

7
  • When I do this I still don't see any of the input files. I've updated the question with the code from my model3 -what settings am I missing? – GeorgeC Mar 11 at 0:22
  • @GeorgeC: Since you're loading a file and the layer isn't already in the project (which wasn't clear at the beginning) I suggest you try native:loadlayer (this tool is exclusive to the modeller) or native:filedownloader. You may hand your path to both tools and use their output as input for your select by attribute. This is theoretical, I haven't tried with dummy data. – Erik Mar 11 at 11:35
  • The issue is that the Selection and Field Calc tools when set to 'Using model input' don't recognise the file that's loaded using native:loadlayer or inputs:File/Folder - can you share the model3 code from your example? – GeorgeC Mar 12 at 0:23
  • I think the overall issue might be you're trying to load an .xlsx file, which QGIS can't really work with @GeorgeC – Erik Mar 12 at 7:39
  • 1
    @GeorgeC great, I edited the answer accordingly. – Erik Mar 17 at 7:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.