As discussed in my previous posts, CAD to GIS integration is a bit messy at times and needs some creative workarounds to make the data usable. This post will discuss how to combine polygons and attribution layers in GIS to make the labels look better and to possibly join to other data tables. The demo requires AutoCAD Map 3D or the ArcGIS for AutoCAD Extension, in order to export from CAD to SHP.
Step One: Export the Rooms Shapefile and Attribution Shapefile from AutoCAD
Type MAPEXPORT in the dialog box and name your shapefile. Next, select the layers you want to export and the data type. You should do this twice- once for rooms and once for Attribution. Obviously, rooms need to be exported as polygons while the attributions should be exported as points. Save the files and open them in your GIS Software.
Step Two: Split the Attribution String at Each New Line
Open the Attribute Table for Attribution Point data and add new fields for however many lines there are in your attribution. Use your judgement to make them the appropriate data type. Then open the Field Calculator and use the .split() Python function to get the data from each line. You are using this script to split on every \n (new line) and ask for whatever line you need. For example, [TEXTSTRING].split(‘\n’) will return the first line and [TEXTSTRING].split(‘\n’) will return the second. Do this so the data is split up and organized before we join to the polygon.
Step Three: Run a Spatial Join
Spatial Join can be found in the Toolbox->Analysis Tools->Spatial Join. Put the Polygons as the Target Feature and the Attribution as the Join Feature. Join One-to-One using the Intersect Match Option. Make sure all fields are selected to join in the dialog box. Run the spatial join and a new polygon layer should appear in a few seconds.
Step Four: Connect to Other Data using Attribution Info (If Possible)
If your attribution included your unique identifier (such as a Room Number or Object ID), you can now use that to connect to other data. The CAD attribution I was working with contained the Room Number which I used to connect to our Archibus database to join all the data from the database.
BEFORE: Labels look off-center and are actually a separate layer than the polygon rooms
After: Labels are centered and only contain the Room Name because we split the information into different layers (Step 2)