2

I have a vector file which I would like to add using "add Vector Layer" (the vector file is a polygon). I would like to convert the polygon file to lines, however only selected polygons. I had an issue using "Extract by attribute" tool, which I tried using it to extract the polygon and then convert it to lines.

Vector Layer (Polygon) --> Extract by attribute (say polygon Name A and B) --> Polygon to lines (convert A and B polygons to lines).

Looking for help in designing it in "Processing Modeler" in QGIS.

4
  • Do you need a step by step answer about the design of the model or do you have a model and have a particular issue with it? Nov 29, 2019 at 4:25
  • I would appreciate to have a model designed. I tried from my side but there is some issue. Nov 29, 2019 at 4:31
  • I need to extract more than 1 attribute value and then use the extracted polgyon to convert to lines. It is good if we go with "Extract by Expression" as you have mentioned. Nov 29, 2019 at 4:55
  • I just added an answer with a step by step detail. I have deleted the previous comment suggesting the use of the "Extract by Expression" algorithm because I found an error in the inputs that I mentioned in that comment when creating the model for the answer, but thanks for accepting the suggestion. Nov 29, 2019 at 5:35

2 Answers 2

7

Create a New Model and add a Vector Layer Input. Restrict accepted geometries to Polygon.

1


Add an Expression Input. The parent layer must be the vector layer input because the expression will be evaluated against that layer.

2


Add an Extract by Expression algorithm. Select the vector layer and the expression from the model as inputs for the algorithm.

3


Add a Polygons to Lines algorithm. The input for this algorithm must be the matching features output of the Extract by Expression algorithm. Give a name for the output because this output will be a new layer in the project.

4


Give a name for the model and save it.

5


The model will be in the Processing Toolbox. Run it. Select the input layer to exctract and write the expression. If you want to return the features which name satisfy one or another equation, you must use the OR operand.

In my case, I will extract the polygons of the Zonificacion layer which "codigo" field value is 'Rme' OR 'Rmi'.

6


The output is a new LineString geometry type vector layer with the selected polygons converted to lines.

7

0
2

In the processing toolbox (Processing > Toolbox > Vector Geometry) search for "Polygons to lines". There you can select the layer where your polygon is (which should already be selected) and click on "Selected features only".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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