Wednesday, August 29, 2018

How to export a shapefile from AutoCAD or Civil 3D

Somebody wants a shapefile and you are an AutoCAD user or a Civil 3D user. How can you give them a shapefile? It's pretty easy. And it requires nothing but AutoCAD (assuming you have the ADESETCRDSYS and MAPEXPORT commands available) . But you need to learn a few new tricks and terms.

Let's assume you want to send a parcel shapefile "parcel".

New Concepts

First, you have to understand two new concepts.


First, the word "shapefile" is used as shorthand for a group of GIS files in a folder that all have the same name and different extensions. So what your dear correspondent wants is probably not really a "file", but a zipped up set of files among which is a file called parcel.shp. You will create this set of files in a new folder to keep things simple. Then you will zip them into a single compressed file called and send the zip file (or another compression format you both like better such as tar.gzip, rar, 7z, etc.).


Second, you can't create shapefiles unless your drawing is connected to geographic coordinates (latitude and longitude). This is done by creating or assigning a translation between your drawing's xy or ne coordinates and latitude and longitude coordinates. This translation turns your drawing into a "geographic projection" of the earth's latitude and longitude onto a plane. In other words, a geographic projection makes your drawing ready to talk to the whole world. Once you choose or create a geographic projection, you can import/export GIS information to/from anybody in the world from/to your drawing in AutoCAD. You will use the ADESETCRDSYS command (or in Civil 3D, Toolspace, Settings, Edit Drawing Settings by right-clicking the drawing name, Unit and Zone) to set up your projection.

Set Your Drawing's Geographic Projection

Setting your drawing's projection can be the daunting part. Let's consider three options for setting up a projection for your drawing, starting from the easiest.

Method 1, easiest

Projection method one, choose and follow: The easiest way to set up a projection is to choose one that looks like it's for your area and then follow it using something like the GEOMAP command (requires an Autodesk login) or a shapefile import you can compare to.

1. Start the ADESETCRDSYS command (or in Civil 3D Toolspace, Settings, Edit Drawing Settings by right-clicking the drawing name, Unit and Zone).

2. Choose a projection. Click the Select Coordinate System button (or in Civil 3D, select from Zone Categories and Available coordinate systems). Search for something that looks right for your area. If you are confused or want to use the SI UTM projection system, a web search will help you select an appropriate projection.

3. Check your projection. Turn on aerial mapping using the GEOMAP command or use the MAPIMPORT command to import a known shape in your area if you have one or can get one from a web site.

4. Draw or move your objects at their correct locations to match the aerial mapping or imported shapefile.

Method 2, custom transformation

Projection method two (only with Civil 3D), choose and transform if you know the projection coordinates for a point on your project or have the inclination to experiment. The next easiest way is to choose a projection for your area and then transform your drawing in a custom projection instead of moving your objects.

1. Follow method one, step 1.

2. Follow method one, step 2.

3. In Civil 3D Toolspace, Settings, Edit Drawing Settings by right-clicking the drawing name, Transformation, check the Apply transform settings. Then enter experimental or known Transformation settings.

4. Follow method one, step 3.

5. Loop back to step 3 and 4 until your projection and transformation fit your drawing to your satisfaction.

Method 3, the ultimate solution

Projection method three, create your drawing on a published projection. The hardest to accomplish, but easiest in the long run, and the way of the future, is to lay out your drawing from the beginning based on published projection horizontal control points from a surveyor or GIS professional. This is really much like method one, but done professionally by a specialist who delivers your drawing to your with a projection already set so you can effortlessly type MAPEXPORT and MAPIMPORT.

Export Your Objects

This part is easy. Use the MAPEXPORT command to choose your objects. 
  • Choose a folder. 
  • Choose ESRI Shapefile type. 
  • Enter a name for the .shp file. 
  • Use the Selection tab to select your objects
    • Use polygon for closed polylines
    • Ignore topology and profiles
  • Ignore the Data tab (see my other post for more info about data)
  • Under the Options tab,
    • Ignore Coordinate conversion
    • Check Treat closed polylines as polygons. (GIS people like polygons to mean "areas")
    • Ignore Driver Options
  • Click okay. 
  • Check that the expected number of objects were exported.
  • Check that several files were created where you expected them.
  • Zip the files together and send to your dear correspondent.

No comments: