Not sure if I'm missing something very basic or not, but I have 6 or 7 shapefile vector layers in a dozen or so models that I need to update a single field with a rather simple formula. I could spend the time to simply edit each layer and update the field, but I was hoping to use the processing modeler to take advantage of batch processing. My trouble is that I'm not understanding how to use the modeler to update existing layers - I've used it several times to create a new layer, but not update any existing ones. I assume I'm just missing a piece of the puzzle?...

An example is that I have a field called "MNCPL_ID" which I want to update with: lpad( "STREETID" ,4,0) || lpad( "SEGMNTID" ,3,0) || lpad( @row_number,3,0) - easily done layer by layer with the field calculator, but how can I automate the process?
(Bonus points if you have a suggestion to make the last 3 numbers sequential for each "STREETID" instead of using @row_number)

*Not familiar with python scripts / still learning.

  • The processing toolbox has a field calculator tool, but it creates a new layer instead of updating the existing layer. – csk Apr 16 '18 at 18:04
  • Thanks - but yeah, that's exactly my dilemma - I'd like to use it to update the layer that's selected as the input rather than create a new one. – CEL-ma Apr 16 '18 at 20:16
  • @CEL-ma - You will need to use a script to update existing layers. The modeler typically creates temporary (or a final) output for most available tools. – Joseph Apr 17 '18 at 9:21
  • Thanks - that's what I was afraid of. I don't have any experience with scripts yet... not even really sure where to begin. – CEL-ma Apr 20 '18 at 12:38

Your Answer

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

Browse other questions tagged or ask your own question.