9

I have only had limited experience with QGIS.

What i have: I currently have many different layers (water mains, sewer mains, drainage etc.). These layers are TAB files with attributed data.

What I want: I want to select (by any means) the relevant layers i need (could be up to 15 layers) and export the layers to DXF so that i can use them in AutoCAD. I would like these layers to export as separate DXF's not all as one DXF. I understand that you can export by selection to dxf, however this is a lengthy process if you need to export many layers.

Why I need this to work: At work I constantly need to export areas of GIS information from our data base and I have been using QGIS as a replacement for Mapinfo (which I do not have access to any more).

In Mapinfo I used a combination of the plug-ins "MapBasic - Batch Cookie Cutter" and "MapBasic - Batch DXF export with attributes" to first cut all the layers I needed based on a polygon area and then converted the cut layers to individual DXF's - this process took only a few minutes and worked well. I do not know how to do this process or equivalent with QGIS.

5
  • Do you think that you could use CMD with a batch script? I've used OGR2OGR with great success, it's available in QGIS but if you have to do it a lot it's something worth scripting... the GUI gets tedious afther the dozenth time. Once you've got the basics working then you only need change the input/output/clip and run. Commented May 10, 2016 at 3:07
  • Thanks for the reply Michael. I am vaguely familiar with OGR2OGR, however it would be great if what i am asking for could be done with plug-ins/existing QGIS features. This is only because at the moment i am not familiar enough to successfully create and run a batch script to do what i need it to do. Commented May 10, 2016 at 3:40
  • 1
    Have a read of planet.qgis.org/planet/tag/ogr2ogr and qgistutorials.com/en/docs/batch_processing.html, to me it's a little tedious.. I learned batch files when there was no such thing as GIS (or even graphics cards on PCs) so I find it easier than trying to flick through GUI forms. Commented May 10, 2016 at 4:23
  • Will the selection query for each layer be the same? Is the query a location query or an attribute query?
    – Pura Vida
    Commented May 10, 2016 at 4:56
  • Thanks Michael and Pura, I use plug-in call "Geo Search" to find the area that i am after so im not really using query at all. Technically all the info is normally on the same road (i have a layer for the center line of all the roads with road names which i could query if need be). If there was a query it would be for location, but i use "geo search" as i find it faster. Commented May 10, 2016 at 5:37

3 Answers 3

3

Under Processing toolbox (you need to have it switched to Advanced interface) you can find GRASS command v.out.dxf which with right click on it you can execute as batch process.

vector to dxf

After that you can select as many layers from open project as you like or browse into directory of your choice. For DXF vector output you only need to set first location and preferably prefix like trans_ and the rest can be populated after that with autofill settings with parameter set to "Name of input vector map".

Good tip is that if you want to populate the whole column with some value, just set the first row and double click on column header. For example to change "Load in QGIS", set first row to No and double click on that header to avoid loading DXF outputs into QGIS.

4
  • Good, I forget to mention batch clip in the processing toolbox is also possible, just search for clip.
    – Miro
    Commented May 10, 2016 at 10:59
  • Hi Miro, I am not getting DXF outputs after running the batch process. For the "Parameters" tab in the batch process i have input the following: In the "Name of input vector map" - i have loaded all the shape files that i clipped using the clipper. In the "GRASS region extent" - left blank. In the "DXF vector" - i have put "trans_" then in "Autofill settings" - "Autofillmode " - i have selected "Fill with parameter values" and in the "Parameter to use" - i have selected "Name of input vector map" and then "RUN", but there are no DXF's, only .dbf .prj and .qpj files with the existing .shp files Commented May 12, 2016 at 5:14
  • 1
    @ThomasWood Sorry, I use that function directly in GRASS. I just tested this now and it seems this tool is not working in all QGIS version I have available. All I could do is to create a bug report on qgis bug tracker so maybe it might work from 2.16.
    – Miro
    Commented May 12, 2016 at 7:20
  • any chance you could show me an example of what you inputted into GRASS? I am not familiar with how to do that - i have looked. Commented May 16, 2016 at 4:48
2

I have found a efficient way to batch export SHP files to DXF based on a selection so that they can be used in Autocad:

  1. Install QGIS Plugin called: "Multiple Layer Selection"
  2. With your required layers loaded, use the "Multiple Layer Selection" plugin to select the specific layers you need to export.
  3. Select "Project" Tab (top left) > "DXF Export" > follow prompts to export to DXF > select "OK".
  4. Navigate to where you saved your DXF file and load in Autocad.

Tip:

  • In the DXF export options - select the "Use layer title as name if set" tick box under the "Select all" button. This will allocate the SHP layer name to the exported data, which is helpful to isolate specific lines etc. in Autocad. List item.
  • If you get a blank DXF file when you open it up after the export, check the CRS (by:"Project" (Top Left) > "Project Properties" > CRS) of the project is the correct CRS.
0
0

For QGIS 3.XX users, exporting multiple layers to .dxf does not require plugins and is quite simple - see process below:

  1. Load all layers you require and zoom to the area you require exporting
  2. Navigate to: Project > Import/Export > Export Project to DXF...>
  3. With the "DXF Export" dialogue box open, select save location and layers should you want to export will already be selected (change if required)
  4. If you want to save a specific area rather than exporting the entire layer, select the tick box (bottom left of dialogue box) "Export features intersecting the current map extent".
  5. If you want to export the entire layer, leave this tick box "Export features intersecting the current map extent" un-ticked.
  6. Navigate to save location, open .dxf and save as .dwg to edit data as require.

Done :)

Your Answer

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

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