Project

General

Profile

Export from QGis to CAD » History » Version 35

Giulio Di Anastasio, 06/05/2021 17:40

1 1 Giulio Di Anastasio
h1. Export from QGis to CAD
2 1 Giulio Di Anastasio
3 1 Giulio Di Anastasio
An algorithm has been created by Selvarani, to see the whole process click here:
4 1 Giulio Di Anastasio
https://redmine.auroville.org.in/projects/gis/wiki/Automatic_export_from_QGis_to_dxf
5 2 Giulio Di Anastasio
6 2 Giulio Di Anastasio
h1. QGis Graphical Modeler: An algorithm to automatically export data directly from Gisaf to .dxf format (CAD)
7 2 Giulio Di Anastasio
8 4 Giulio Di Anastasio
> * Login to PostGIS
9 4 Giulio Di Anastasio
10 4 Giulio Di Anastasio
> * Directly from the Gisaf server, load all the layers which need to be converted into .dxf format
11 4 Giulio Di Anastasio
12 4 Giulio Di Anastasio
> * Go to Processing Menu, click on “Graphical Modeler” (or Ctrl+Alt+G)
13 5 Giulio Di Anastasio
14 8 Giulio Di Anastasio
15 7 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10620/Graphical%20Modeler%20Menu.png!
16 1 Giulio Di Anastasio
17 8 Giulio Di Anastasio
18 6 Giulio Di Anastasio
19 5 Giulio Di Anastasio
>  * The “Model Designer” window will open:  
20 5 Giulio Di Anastasio
21 10 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10621/Graphical%20Modeler%20Window.png!
22 9 Giulio Di Anastasio
23 9 Giulio Di Anastasio
The final model will look like this:
24 9 Giulio Di Anastasio
25 10 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10622/Final%20Model%20Image.png!
26 11 Giulio Di Anastasio
27 11 Giulio Di Anastasio
28 11 Giulio Di Anastasio
*Below, the explanation on how the algorithm has been created.*
29 11 Giulio Di Anastasio
30 13 Giulio Di Anastasio
> * An input to the algorithm is needed: go to “Inputs” tab and double click on “Vector Layer”
31 13 Giulio Di Anastasio
32 13 Giulio Di Anastasio
33 13 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10623/Inputs.png!
34 14 Giulio Di Anastasio
35 14 Giulio Di Anastasio
The window “Input Vector layer Parameter Definition” will open:
36 14 Giulio Di Anastasio
> * in “Description”, enter “Input Vector layer”
37 14 Giulio Di Anastasio
> * in “Geometry type” select “Any Geometry Type”
38 14 Giulio Di Anastasio
> * Click “Ok”
39 14 Giulio Di Anastasio
40 14 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10624/Inputs%20Window.png!
41 15 Giulio Di Anastasio
42 15 Giulio Di Anastasio
Input is created as above.
43 15 Giulio Di Anastasio
As a second step, features need to be filtered, because some layers have different “Status” (E, D, F, etc. as defined in CSR Geomatics CAD Layer Naming Standards):
44 15 Giulio Di Anastasio
> * in the Algorithms panel, type “filter” in the Search Box: this way, all existing algorithms related to “filter” will be listed
45 15 Giulio Di Anastasio
> * double click on “Feature filter”
46 15 Giulio Di Anastasio
47 15 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10625/Feature%20Filter.png!
48 16 Giulio Di Anastasio
49 16 Giulio Di Anastasio
50 16 Giulio Di Anastasio
“Feature filter” window will open:
51 16 Giulio Di Anastasio
52 16 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10626/Feature%20Filter%20Window.png!
53 16 Giulio Di Anastasio
54 16 Giulio Di Anastasio
> * Click on ‘Add output filter’ icon
55 16 Giulio Di Anastasio
56 16 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10627/Add%20Output%20Filter.png!
57 16 Giulio Di Anastasio
58 16 Giulio Di Anastasio
> * Click on expression button  !https://redmine.auroville.org.in/attachments/download/10628/Expression%20Button.png! to write an expression for the filter.
59 16 Giulio Di Anastasio
60 16 Giulio Di Anastasio
> * The Expression dialog will open, type the criteria for defining the filter, e.g. “STATUS”=’E’
61 16 Giulio Di Anastasio
62 16 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10629/Status%20E%20Expression.png!
63 17 Giulio Di Anastasio
64 17 Giulio Di Anastasio
> * Click “Ok”: the expression is added in the table of “Outputs and filters” as below.
65 17 Giulio Di Anastasio
> * In the field “Output Name”, type in the output as ‘E’.
66 17 Giulio Di Anastasio
67 17 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10630/Output%20Name.png!
68 18 Giulio Di Anastasio
69 18 Giulio Di Anastasio
> * Repeat the same steps for all other status (Like D,F,N,T,M and X)
70 18 Giulio Di Anastasio
> * Click on the “Input layer” button and select “Model Input” in the drop-down list, it will change to “Input Vector layer”. Click on “Ok”
71 18 Giulio Di Anastasio
72 18 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10631/All%20Filters%20Ready.png!
73 18 Giulio Di Anastasio
74 18 Giulio Di Anastasio
---
75 18 Giulio Di Anastasio
76 18 Giulio Di Anastasio
---
77 18 Giulio Di Anastasio
78 18 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10632/Input%20Layer%20for%20Filters.png!
79 19 Giulio Di Anastasio
80 19 Giulio Di Anastasio
The model will look like below:
81 19 Giulio Di Anastasio
82 19 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10633/Model%201%20Graphics.png!
83 19 Giulio Di Anastasio
84 19 Giulio Di Anastasio
As the input layers were taken directly from Gisaf server, where their CRS is WGS 84-EPSG:4326, all outputs need to be reprojected in TM AUSPOS CRS, because the CAD overall survey map is in TM AUSPOS:
85 19 Giulio Di Anastasio
> * Go to “Algorithms” panel and type “reproject” in the Search Box: this way, all existing algorithms related to “reproject” will be listed
86 19 Giulio Di Anastasio
> * Double click on “Reproject layer” under “Vector general”
87 19 Giulio Di Anastasio
88 19 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10634/Reproject%20Algorithm.png!
89 20 Giulio Di Anastasio
90 20 Giulio Di Anastasio
The “Reproject layer” dialog will open:
91 20 Giulio Di Anastasio
> * In the “Description” box type “Reproject layer ‘E’”: this will reproject only the features with status ‘E’
92 20 Giulio Di Anastasio
93 20 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10635/Reproject%20Layer.png!
94 20 Giulio Di Anastasio
95 20 Giulio Di Anastasio
> * In “Input layer” drop-down select “Algorithm Output”, click on the related box and a list of all available algorithm outputs will appear.
96 20 Giulio Di Anastasio
> * In “Using algorithm output” select ““E” from algorithm “Feature filter””
97 20 Giulio Di Anastasio
98 20 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10636/Reproject%20Layer%20Input.png!
99 20 Giulio Di Anastasio
100 20 Giulio Di Anastasio
> * In “Target CRS” select “USER;100028-TM AUSPOS”
101 20 Giulio Di Anastasio
102 20 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10637/Reproject%20Layer%20CRS.png!
103 21 Giulio Di Anastasio
104 21 Giulio Di Anastasio
> * Click “Ok”. The model will look like below:
105 21 Giulio Di Anastasio
106 21 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10638/Model%201%20with%20Reprojection%20Graphics.png!
107 22 Giulio Di Anastasio
108 22 Giulio Di Anastasio
> * Follow the same steps for all the status (N, D, F, T, M, X), from “Reproject” onwards
109 22 Giulio Di Anastasio
110 22 Giulio Di Anastasio
Once finished, the model will look like this:
111 22 Giulio Di Anastasio
112 22 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10639/Full%20Model%20Image%20with%20Reprojections.png!
113 22 Giulio Di Anastasio
114 22 Giulio Di Anastasio
The final step of the algorithm is to convert the outputs to .dxf format:
115 22 Giulio Di Anastasio
116 22 Giulio Di Anastasio
> * Go to “Algorithms” panel, type “dxf” in the Search Box: this way, all existing algorithms related to “dxf” will be listed,
117 22 Giulio Di Anastasio
> * Double click on “v.out.dxf” from “GRASS”
118 22 Giulio Di Anastasio
119 22 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10640/Grass%20dxf%20Algorithm.png!
120 22 Giulio Di Anastasio
121 22 Giulio Di Anastasio
> * The “v.out.dxf” window will open. In “Description” type “v.out.dxf ‘E’”
122 22 Giulio Di Anastasio
> * In “Name of input vector map”, click on the button and select “Algorithm output”
123 22 Giulio Di Anastasio
124 22 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10641/Grass%20dxf%20Algorithm%20Window.png!
125 22 Giulio Di Anastasio
126 22 Giulio Di Anastasio
> * In the drop-down list, select ““Reprojected” from algorithm “Reproject layer “E””
127 22 Giulio Di Anastasio
128 23 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10642/Grass%20dxf%20Algorithm%20Inputs%20Window.png!
129 24 Giulio Di Anastasio
130 24 Giulio Di Anastasio
> * In “DXF vector” type “DXF ‘E’”. This means that the dxf is the final output of the algorithm
131 24 Giulio Di Anastasio
132 24 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10643/Grass%20dxf%20Algorithm%20Output%20Window.png!
133 25 Giulio Di Anastasio
134 25 Giulio Di Anastasio
> * Click “Ok”. Now the model will be as below:
135 25 Giulio Di Anastasio
136 25 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10644/Full%20Model%20Image%20with%20Reprojections%20and%201%20Output.png!
137 26 Giulio Di Anastasio
138 26 Giulio Di Anastasio
> * Repeat the same steps for all other status.
139 26 Giulio Di Anastasio
140 26 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10645/Final%20Model.png!
141 26 Giulio Di Anastasio
142 26 Giulio Di Anastasio
The algorithm is now ready to convert QGis layers to .dxf format.
143 28 Giulio Di Anastasio
144 27 Giulio Di Anastasio
> * To save the model, click on  !https://redmine.auroville.org.in/attachments/download/10646/Save%20Button.png! “Save”
145 26 Giulio Di Anastasio
> * “Save Model” window will open, give a name to the model (e.g. ‘Export SHP to DXF’) and save it.
146 28 Giulio Di Anastasio
147 28 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10647/Save%20Model%20Window.png!
148 28 Giulio Di Anastasio
149 28 Giulio Di Anastasio
Once saved in the QGis models folder, the model can be opened from the Graphical Modeler and used directly:
150 28 Giulio Di Anastasio
151 28 Giulio Di Anastasio
> * Click  on  !https://redmine.auroville.org.in/attachments/download/10648/Run%20Button.png! “Run model” icon.
152 28 Giulio Di Anastasio
153 28 Giulio Di Anastasio
The “Model” Dialog box will open:
154 29 Giulio Di Anastasio
155 29 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10649/Model%20Window.png!
156 30 Giulio Di Anastasio
157 30 Giulio Di Anastasio
> * Click  on “Run as Batch Process”(bottom left corner),
158 30 Giulio Di Anastasio
> * Batch Processing window will open
159 30 Giulio Di Anastasio
> * Click on “Autofill” under ‘Input Vector layer’
160 30 Giulio Di Anastasio
> * In the drop-down window, click on “Select from Open Layers”,
161 30 Giulio Di Anastasio
162 30 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10650/Batch%20Processing%2001.png!
163 30 Giulio Di Anastasio
164 30 Giulio Di Anastasio
> * The ‘Multiple selection’ box will open, click on “Select all”, then click on “Ok”.
165 30 Giulio Di Anastasio
166 30 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10651/Batch%20Processing%20Multiple%20Selection.png!
167 33 Giulio Di Anastasio
168 33 Giulio Di Anastasio
Now all the layers are selected for the process.
169 33 Giulio Di Anastasio
170 33 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10652/Batch%20Processing%20All%20Layers.png!
171 33 Giulio Di Anastasio
172 33 Giulio Di Anastasio
> * Click on !https://redmine.auroville.org.in/attachments/download/10653/Ellipsis%20Button.png! on first layer, first status (e.g.: under “dxf ’E’”)
173 34 Giulio Di Anastasio
174 33 Giulio Di Anastasio
The “Save file” window will open
175 34 Giulio Di Anastasio
176 34 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10654/Save%20dxf%20Window.png!
177 35 Giulio Di Anastasio
178 35 Giulio Di Anastasio
> * Select the folder where to save and type in the letter indicating the status followed by a hyphen (e.g. “E-“) and click on “Ok” 
179 35 Giulio Di Anastasio
> * The “Autofill settings” box will open:
180 35 Giulio Di Anastasio
> * In “Autofill mode”, select “Fill with parameter values”
181 35 Giulio Di Anastasio
> * In “Parameter to use”, select “Input Vector layer”
182 35 Giulio Di Anastasio
> * Click on “Ok”: it will automatically fill for other layers also
183 35 Giulio Di Anastasio
184 35 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10655/Batch%20Processing%20Complete%20Autofilling.png!
185 35 Giulio Di Anastasio
186 35 Giulio Di Anastasio
> * Follow the same steps for all other status outputs.
187 35 Giulio Di Anastasio
> * Once details for all the status are entered, click on “Run” for the process to execute
188 35 Giulio Di Anastasio
189 35 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10656/Batch%20Processing%20Processing%20Window.png!
190 35 Giulio Di Anastasio
191 35 Giulio Di Anastasio
> * Once done, click on “Close”.
192 35 Giulio Di Anastasio
193 35 Giulio Di Anastasio
> * All dxf files are exported into the selected folder, with the status followed by the name of the layers.
194 35 Giulio Di Anastasio
195 35 Giulio Di Anastasio
p=. !https://redmine.auroville.org.in/attachments/download/10657/All%20Saved%20dxf%20Files.png!