Project

General

Profile

Export from QGis to CAD » History » Version 26

Version 25 (Giulio Di Anastasio, 06/05/2021 17:20) → Version 26/35 (Giulio Di Anastasio, 06/05/2021 17:24)

h1. Export from QGis to CAD

An algorithm has been created by Selvarani, to see the whole process click here:
https://redmine.auroville.org.in/projects/gis/wiki/Automatic_export_from_QGis_to_dxf

h1. QGis Graphical Modeler: An algorithm to automatically export data directly from Gisaf to .dxf format (CAD)

> * Login to PostGIS

> * Directly from the Gisaf server, load all the layers which need to be converted into .dxf format

> * Go to Processing Menu, click on “Graphical Modeler” (or Ctrl+Alt+G)

p=. !https://redmine.auroville.org.in/attachments/download/10620/Graphical%20Modeler%20Menu.png!

> * The “Model Designer” window will open:

p=. !https://redmine.auroville.org.in/attachments/download/10621/Graphical%20Modeler%20Window.png!

The final model will look like this:

p=. !https://redmine.auroville.org.in/attachments/download/10622/Final%20Model%20Image.png!

*Below, the explanation on how the algorithm has been created.*

> * An input to the algorithm is needed: go to “Inputs” tab and double click on “Vector Layer”

p=. !https://redmine.auroville.org.in/attachments/download/10623/Inputs.png!

The window “Input Vector layer Parameter Definition” will open:
> * in “Description”, enter “Input Vector layer”
> * in “Geometry type” select “Any Geometry Type”
> * Click “Ok”

p=. !https://redmine.auroville.org.in/attachments/download/10624/Inputs%20Window.png!

Input is created as above.
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):
> * in the Algorithms panel, type “filter” in the Search Box: this way, all existing algorithms related to “filter” will be listed
> * double click on “Feature filter”

p=. !https://redmine.auroville.org.in/attachments/download/10625/Feature%20Filter.png!

“Feature filter” window will open:

p=. !https://redmine.auroville.org.in/attachments/download/10626/Feature%20Filter%20Window.png!

> * Click on ‘Add output filter’ icon

p=. !https://redmine.auroville.org.in/attachments/download/10627/Add%20Output%20Filter.png!

> * Click on expression button !https://redmine.auroville.org.in/attachments/download/10628/Expression%20Button.png! to write an expression for the filter.

> * The Expression dialog will open, type the criteria for defining the filter, e.g. “STATUS”=’E’

p=. !https://redmine.auroville.org.in/attachments/download/10629/Status%20E%20Expression.png!

> * Click “Ok”: the expression is added in the table of “Outputs and filters” as below.
> * In the field “Output Name”, type in the output as ‘E’.

p=. !https://redmine.auroville.org.in/attachments/download/10630/Output%20Name.png!

> * Repeat the same steps for all other status (Like D,F,N,T,M and X)
> * 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”

p=. !https://redmine.auroville.org.in/attachments/download/10631/All%20Filters%20Ready.png!

---

---

p=. !https://redmine.auroville.org.in/attachments/download/10632/Input%20Layer%20for%20Filters.png!

The model will look like below:

p=. !https://redmine.auroville.org.in/attachments/download/10633/Model%201%20Graphics.png!

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:
> * Go to “Algorithms” panel and type “reproject” in the Search Box: this way, all existing algorithms related to “reproject” will be listed
> * Double click on “Reproject layer” under “Vector general”

p=. !https://redmine.auroville.org.in/attachments/download/10634/Reproject%20Algorithm.png!

The “Reproject layer” dialog will open:
> * In the “Description” box type “Reproject layer ‘E’”: this will reproject only the features with status ‘E’

p=. !https://redmine.auroville.org.in/attachments/download/10635/Reproject%20Layer.png!

> * In “Input layer” drop-down select “Algorithm Output”, click on the related box and a list of all available algorithm outputs will appear.
> * In “Using algorithm output” select ““E” from algorithm “Feature filter””

p=. !https://redmine.auroville.org.in/attachments/download/10636/Reproject%20Layer%20Input.png!

> * In “Target CRS” select “USER;100028-TM AUSPOS”

p=. !https://redmine.auroville.org.in/attachments/download/10637/Reproject%20Layer%20CRS.png!

> * Click “Ok”. The model will look like below:

p=. !https://redmine.auroville.org.in/attachments/download/10638/Model%201%20with%20Reprojection%20Graphics.png!

> * Follow the same steps for all the status (N, D, F, T, M, X), from “Reproject” onwards

Once finished, the model will look like this:

p=. !https://redmine.auroville.org.in/attachments/download/10639/Full%20Model%20Image%20with%20Reprojections.png!

The final step of the algorithm is to convert the outputs to .dxf format:

> * Go to “Algorithms” panel, type “dxf” in the Search Box: this way, all existing algorithms related to “dxf” will be listed,
> * Double click on “v.out.dxf” from “GRASS”

p=. !https://redmine.auroville.org.in/attachments/download/10640/Grass%20dxf%20Algorithm.png!

> * The “v.out.dxf” window will open. In “Description” type “v.out.dxf ‘E’”
> * In “Name of input vector map”, click on the button and select “Algorithm output”

p=. !https://redmine.auroville.org.in/attachments/download/10641/Grass%20dxf%20Algorithm%20Window.png!

> * In the drop-down list, select ““Reprojected” from algorithm “Reproject layer “E””

p=. !https://redmine.auroville.org.in/attachments/download/10642/Grass%20dxf%20Algorithm%20Inputs%20Window.png!

> * In “DXF vector” type “DXF ‘E’”. This means that the dxf is the final output of the algorithm

p=. !https://redmine.auroville.org.in/attachments/download/10643/Grass%20dxf%20Algorithm%20Output%20Window.png!

> * Click “Ok”. Now the model will be as below:

p=. !https://redmine.auroville.org.in/attachments/download/10644/Full%20Model%20Image%20with%20Reprojections%20and%201%20Output.png!

> * Repeat the same steps for all other status.

p=. !https://redmine.auroville.org.in/attachments/download/10645/Final%20Model.png!

The algorithm is now ready to convert QGis layers to .dxf format.
> * To save the model, click on https://redmine.auroville.org.in/attachments/download/10646/Save%20Button.png “Save”
> * “Save Model” window will open, give a name to the model (e.g. ‘Export SHP to DXF’) and save it.