duminică, 6 iunie 2010

DWG to SHP [from AutoCAD to ArcGIS]

CONVERT DWG TO SHP!

If you do a lot of work in both ArcGIS and AutoCAD, as i do, you will know the difficulties of converting between the two. Although AutoCAD files can be directly imported into ArcGIS and ArcGIS can export to DWF files (which are directly compatible with AutoCAD), jumping between the two can have extremely annoying hidden difficulties.

This post, as well as this blog, will focus on working in the two environments and making your work mesh together in concert. This post is a guide for to simply add Autodesk Autocad DWG drawings into ArcGIS 9.2. So, without further ado...

As with any ArcGIS document, you need to make sure that you .DWG file is saved in a directory that is no further than two folders from the root drive. In addition, you must make sure that there are no spaces in the folder or filenames. eg. c:\Arc\GIS\cadfile.dwg

Next open and save a ArcMap document in the same folder. There can be spaces in this filename. Add data to the data frame > select the autoCAD document you wish to import. If the CAD is simplistic and is only one layer, you are done! However, since 99% of CAD documents do not fall within this description, you are not done.

The CAD document, by default, combines all the layers, annotation, etc... into one group layer in ArcGIS. You can expand this group layer and see the nonsensical way it displays the 5 layers within it by default - complete with annoying ArcGIS random colours and and strange coordinate/range descriptions. They will fall under categories like annotation, point, polygon, polyline etc... These are the filetypes that ArcGIS is most familiar with, but who wants them in one layer!? And the descriptions of the symbology is equally confusing. eg. continuous 4,62 etc...

Your goal is most likely to seperate the layers back to the point that they used to be when you had them in AutoCAD 2008 (or whatever version you are using). You may want all of the layers or you may want a select few. The process, as of right now, is somewhat confusing. I am currently working on a more streamlined process and will be blogging about it soon. But for now here is the method for extracting autocad layers from ArcGIS:

To do this, we must first right click on the CADD layer within the group layer > properties > drawing layers tab > then click disable all > then click the first of the layers you want to isolate (only one unless you want to combine several layers into one layer).

Close the window > right click again on the layer > go to data > expand it > click export data...
> chose a place to save the file and a file name and voila!

You have a layer that is an ESRI shape file (.shp). You can repeat this conversion process for each of the AutoCAD layers you want made into ESRI ArcGIS layers.

As I said, I am currently writing code to streamline this process and it will be done and posted on these forums soon!

also you can used CadToShape ... trial version here!