How to convert SHP to DWG (Esri Shapefile to AutoCAD)

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

Introduction

This example will show you how to transform the City of Vancouver Postal Code data from Esri shapefile (*.shp) to an AutoCAD drawing (*.dwg) format and store the attributes as extended entity data.

The Esri shapefile (forwardsortationareas.shp) denotes the different postal districts covering Vancouver. A forward sortation area (FSA) is a geographical region in which all postal codes start with the same three characters. The first letter of an FSA code denotes a particular "Postal District".

 

Video

This video was created with FME version 2016.0. Some of the steps might be slightly different, but the overall process is the same for newer versions of FME.

 

Step-By-Step Instructions

1. Inspect the Data in FME

The first step is to inspect the ForwardSortationAreas.shp file. Open a blank FME Workspace and add a new reader. In the reader dialog, type in Esri Shapefile, then browse to the ForwardSortationAreas.shp file. Click OK to add the reader to the canvas.

reader.png


Now to view the data, click on the ForwardSortationAreas reader feature type on the canvas to open the popup menu. Then on the popup menu click the View Source Data button to view the data in the Visual Preview Window.

popupmenu.png

 

We have area features representing the forward sortation areas. There is a single attribute (CFSAUID) which identifies the forward sortation area, which is the first three characters of the Postal Code.

visualpreview.png

 

Note: This step can also be completed in FME Data Inspector for versions previous to FME 2019. Just be sure to add the Esri shapefile reader to FME Workbench after inspecting the data.

 

2. Set the Output (Writer) Format to AutoDesk AutoCAD DWG/DWF

Next, we need to add a writer to the canvas. Click on the Add Writer and in the Add Writer dialog box, for the Format, select AutoDesk AutoCAD DWG/DWF.

For the Dataset, browse to where you would like to save the file and name the file VancouverFSA.dwg.

writer.png

 

By default, AutoCAD DWG files do not store attributes. However, attributes can be stored in AutoCAD DWG files as extended entity data.

Click on Parameters, and set the Attribute Output to “Extended Entity Data”. Then click OK and OK again to add the writer.

writerparams.png

 

3. Connect Feature Types and then Click the Run Button

Connect the reader and writer feature types. Once connected, run the workspace by clicking on the green play button.

 

4. View the Feature Dataset & Feature Class in Visual Preview

To view the output dataset, click on the ForwardSortationAreas writer feature type to open the popup menu. Then click on the Open Containing Folder button.

writerpopupmenu.png

 

Next, either open FME Data Inspector or use Visual Preview and drag the VancouverFSA.dwg file into FME Data Inspector or the Visual Preview window. In the Select Dataset to View dialog, click on the Parameters button.

selectdataset.png

 

In the parameters, set Group Entities By to Attribute Schema. This will ensure that you can view the attributes in your AutoCAD DWG file that were saved as extended entity data. Then uncheck Explode Blocks Into Entities. This will keep any of the polygons together as one unit and not break them into their parts. Click OK twice to close the dialog and view the dataset.

visualpreviewparams.png

 

With the Attribute Schema selected, you can now see the attributes when viewing a DWG file in FME. Refer to the Knowledge Base article Viewing and Inspecting AutoCAD DWG Data: Grouping Entities for more information on the “Group Entities By” options for AutoCAD DWG/DXF files.

finaloutput.png

 

Data Attribution

The Forward Sortation Areas data set provided here comes from Statistics Canada, 2011 Census Digital Boundary Files, 2013. Reproduced and distributed on an "as is" basis with the permission of Statistics Canada. © This data includes information copied with permission from Canada Post Corporation.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.