TransWikia.com

How to specify dependable layer names in QGIS Processing Modeller

Geographic Information Systems Asked by Bruce Mitchell on December 6, 2020

I am creating a model in QGIS (3.10.3) Processing Modeller (Win 10[64]).

The objective is to create Voronoi polygons from centroids that are clipped to a higher, polygon, geometry. This produces clip slivers that either do (Voronoi-with-centroid) or do not (‘merger-candidates’) contain an centroid.

I create a UUID for every Voronoi (whether it has a centroid or not).

Then identify the neighbours, and the shared boundary lengths as per:
https://spatialthoughts.com/2020/04/08/calculating-shared-border-lengths/

Then dissolve the merger-candidates into the neighbouring Voronoi-with-centroid with which it shares the longest boundary.

I am quite happy with this approach and am confident it will produce the result I want.

However, my model (see GoogleDrive link below) is doing something odd.

The command ‘create UUID’ does what it should, but additionally, adds a UUID to the layer name.

So, for the next instruction – ‘Identify Neighbours’ – when I enter the Expression dialog, QGIS offers all the ‘…_OUTPUT’ from the previously completed instructions. But ‘Create_UUID_OUTPUT’ doesn’t appear to be the right thing to include in the "spatialthoughts" code.

My adaptation of that code is, so far:

array_to_string(array_remove_all(aggregate(

layer:=  ## THIS IS WHAT DOESN'T WORK YET ##,

aggregate:='array_agg' ,

expression:=$UUID,

filter:=intersects($geometry, geometry(@parent))

),"UUID"))

If I double-click Create_UUID_OUTPUT on the right in Processing Modeller, @Create_UUID_OUTPUT appears in the code window on the left. When this is added into layer:= this then generates:
”’
"Eval Error:Cannot find layer with name or ID ” "
”’

So I looked at the "Map Layers" drop down on the right.

Sure enough, there is a "Voronois_fixed_with_UUIDs" layer, which is exactly what I would have expected, so, I thought, let’s use that.

However, when I double-click that, I get ‘Calculated_11a2a0f5_618c_4b85_90e9_07c97cdf360b’ on the left.

So, the layer name itself has gained a UUID, and this changes every time I run the model. No, no, no. I do not want that.

I expect "Voronois_fixed_with_UUIDs" to be the layer name, for this not to change, and for it to appear in the code on the left when double-clicked on the right.

In QGIS desktop, the layer does appear with that name. Its properties may be seen at the bottom of this post.

So I have two questions:

  1. How do I stop the "Create_UUID" instruction adding a UUID to the layer name?
  2. What should I put in the line "layer:= ## THIS IS WHAT DOESN’T WORK YET ##, "

Many thanks for your attention: I would very much appreciate any guidance you can offer.

The QGIS model may be downloaded from my GoogleDrive:
https://drive.google.com/file/d/1CDJ_pd2alE8viwiPVH-qB70xwGfDozcC/view?usp=sharing

Layer properties in QGIS
(note, there’s a UUID, but it’s different – due to having run the model again):

Name

Voronois_fixed_with_UUIDs

Source

MultiPolygon?crs=EPSG:27700&field=fid:long(0,0)&field=OBJECTID:long(0,0)&field=zone_code:string(14,0)&field=Shape_Length_1:double(0,0)&field=Shape_Area_1:double(0,0)&field=Shape_Length_12:double(0,0)&field=Shape_Area_12:double(0,0)&field=Shape_Length_12_13:double(0,0)&field=Shape_Area_12_13:double(0,0)&field=Shape_Length_12_13_14:double(0,0)&field=Shape_Area_12_13_14:double(0,0)&field=opcs_code:string(9,0)&field=Ward71Code:string(16,0)&field=Dist71Code:string(16,0)&field=Cnty71Code:string(16,0)&field=Pop71:double(0,0)&field=ORIG_FID:integer(0,0)&field=%24UUID:string(38,0)&uid={f53eb83b-8da7-4f8f-a045-98a48f752bc6}

Storage

Memory storage

Comment

Encoding

UTF-8

Geometry

Polygon (MultiPolygon)

CRS

EPSG:27700 – OSGB 1936 / British National Grid – Projected

Extent

446240.0011192215606570,92182.7952580302953720 : 453679.9979932568967342,96610.0049105565994978

Unit

meters

Feature count

41

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP