So, you have an ESRI Shapfile with contour data in it and you want to create a surface from it. How is this done? Well, honestly, it really isn’t too terribly hard. There are, however, some gotchas you have to be aware of when using the easy method. Part 2 in this series will cover a more involved way of accomplishing this but will give you a much better surface.

Creating Surface

First off, displaying the contours in your drawing, this part is super easy. Simply drag your .shp file from Windows Explorer into you drawing area and it will connect to the .shp file and display it’s contents.

Importing a Shapefile

Importing a Shapefile

This part isn’t necessary but it is a nice way to compare the surface you get from the data you have.

Now, let’s actually create the surface. On the home tab of the Civil 3D Workspace on the ribbon, expand out the Surfaces pulldown and choose “Create Surface from GIS Data”.

Create Surface from GIS Data

Create Surface from GIS Data

This will open up another of the famous Civil 3D Wizards. The first tab allows you to set the properties of your new surface, such as the name, description, style, etc. I recommend not using a style that displays a lot of data. Typically, GIS files have a TON of data in them! You don’t want to unnecessarily overtax your system.

Object Options

Object Options

On the next tab, Connect to Data, you’ll choose the type of data you want to connect to and then the actual data source. Depending on the data type, options within the dialog will become available. In this example, I’m connecting to a shapefile so I choose that option and then browse to the file. Don’t forget to click on the Login button at the bottom (not sure why you need to login to a shapefile but you do).

Connect to Data

Connect to Data

the Schema and Coordinates section simply allows you to choose the data you want to bring in and assign it a coordinate system (if it doesn’t already have one). In this case, I simply toggled on the only data that was available. If you are using something other then a shapefile, you might have additional options here.

Schema and Coordinates

Schema and Coordinates

The Geospatial Query section allows you to choose the area of the data source that you want to create the surface from. In most cases, you don’t want to create a surface from the entire shapefile as that is just overkill. Choose the method you want to select the area and then define the area (it’s pretty straight forward). At the bottom of the dialog, you’ll see two options, Inside and Crossing. In most cases, I’ve found the Crossing option to work better. If you choose Inside, it will only select the objects that are completely inside the area of interest and ignore any that extend beyond it. Since most contours are very long, they’ll extend beyond your boundary and they won’t be selected so make sure to choose the Crossing option.

Geospatial Query

Geospatial Query

Finally, the Data Mapping section. This if one of the most important parts of the dialog. A shapefile is 2d file. This means the lines within the shapefile only have X,Y values, no Z values. The elevation of the contours are then assigned to the objects as a data field. You’ll need to tell Civil 3D which field within the shapefile represents the elevations of the contours.

Data Mapping

Data Mapping

Clicking Finish, Civil 3D then creates the surface, adds the data to it, and displays it in your drawing.

Surface Created

Surface Created

Surface Issues

Now that the surface is created, you should be aware of some issues with creating a surface using this method. First thing, not all the points from your contours are used in creating the surface. There is an automatic weeding being applied to the data that you have no ability to control.

Data Points Weeded Out

Data Points Weeded Out

Whenever you have a surface created from contour data, there is the possibility that flat areas can be created. Civil 3D has the ability to minimize these flat areas. When creating a surface from a shapefile, Civil 3D automatically applies the Minimize Flat Areas edit to your surface but, you can change the settings in this command. Add the problem, you can’t go back and change the settings later, remove the edit to add it back in, or do anything with it. You are stuck with it the way it is. See THIS post for information about the flat areas and what you settings you should use. When creating a surface from a shapefile, the “Swap Edges” option is not used and therefore, creates a less then desirable surface.

Missing Contours

Missing Contours

Ok, so the contours aren’t really missing, they should just follow the data better. In other words, there should be contours in the areas that I’ve pointed out in the image.

For an alternative method of creating the surface from a shapefile, stay tuned for Part 2.

Advertisements

In PART 1 of this series of posts, I showed you how to create a surface in Civil 3D from a shapefile that contained contour data. I also showed you some of the issues with using that command. In this post, I’ll show you how an alternative method for creating a surface from a shapefile. There are pros and cons to this method compared with the previous method:

  • Pros
    • Allows you to use all the data in the shapefile as needed.
    • Gives you control over the weeding and suplementing factors for the surface creation.
    • Allows you to use the correct options for minimizing flat areas.
  • Cons
    • There are a lot of steps to this process.
    • It potentially creates a much larger surface (data wise)

There are a lot of steps to this process so rather then detailing each step like I normally do, I’m going to summarize the steps here and then, if you need more detailed information, you can watch the included video.

  1. Import the shapefile into a drawing as AutoCAD entities (create object data from the shapefile data).
  2. Save the file as a new drawing and close it.
  3. Create a new drawing and attach the drawing with the contours to it via the Map Explorer in the Map Task Pane.
  4. Query the contours from the old drawing into the new drawing altering the elevations of the polylines to the elevation from the shapefile.
  5. Create a new surface.
  6. Add a dataclip boundary to the surface.
  7. Add the contours to the surface as contour data (make sure you toggle on all four minimize flat area options).

And that’s it! This will create a much better surface from your data but it definitely takes a lot longer to do.

So, you want to bring a surface from Civil 3D into Revit? It’s pretty easy, provided you have both Civil 3D and Revit Structure. What? You don’t have them both? You only have Civil 3D? Are you sure? Recently, anyone that had Civil 3D on subscription was automatically upgraded to the Infrastructure Design Suite Premium and, guess what, it has Revit Structure! So most likely, unless you specifically opted out of the upgrade, you have access to Revit Structure.

Please read this entire post as there is some very important information near the end. First, I’ll tell you how to Import the Surface and then I’ll tell you about the Limitations and Issues.

Import the Surface

The Bridge Modeling Tools have been around for a while now. If you haven’t installed them yet, go to the subscription website and download them. You’ll need both of them, one for Revit Structure and one for Civil 3D.

After you have installed them, simply open the drawing that has the surface in Civil 3D and then open the file in Revit Structure you want to bring the surface into. In Revit, there is a little bit of setup you need to do (if you’re a Revit person, you probably already know this stuff). Go to your “default 3D view” (that’s the “doghouse” on the quick access toolbar) and edit the Visibility/Graphic Overrides.

Setting Up Revit

Setting Up Revit

In the Visibility/Graphics Overrides, turn on the display of the Topography.

Topography Options

Topography Options

This will allow you to see the surface when you bring it in. Once Revit is set up (I’m sure there are some settings I’m not aware of and I’m sure a Revit Guru will correct me on this), go to the Extensions tab, expand out the Civil Structures tool and choose “Integration with AutoCAD Civil 3D”.

Integrate with Civil 3D

Integration with Civil 3D

If you have more than one drawing open in Civil 3D, you’ll need to choose the drawing with the surface in it, the surface(s) in the drawing you want to import, and then have it import the surface into Revit.

Import Settings

Import Settings

After hitting OK, you then have some options when importing the surface, such as the material that will be assigned to the surface and the limits of the surface (if you don’t want the entire thing).

Terrain Definition

Terrain Definition

Once done, you’ll have a surface in Revit that you can do whatever you want to with it.

Surface in Revit

Surface in Revit

Limitations and Issues

This tool is really, I mean REALLY cool! A few years ago, one of my coworkers (Brian Mackey) and I worked up a technique to do this very thing and believe me, it wasn’t this easy. This is easy but, you need to know what it does. If I take this surface in Revit and I compare it to the surface in Civil 3D (I’ve stylized it in C3D to be similar to what we see in Revit) you’ll see they are quite different.

Civil 3D vs. Revit

Civil 3D vs. Revit

As you can see, the limits of the surface from Civil 3D aren’t honored in Revit. In fact, the only thing that comes through in Revit is the surface points. If you have added any breaklines or boundaries to the surface in Civil 3D, Revit doesn’t recognize those. For you civil folks, to get a feel for what Revit is doing, basically extract the surface points from a surface and then add them to a new surface and that’s what you will have in Revit. This is still better than what we had though so it’s definitely an improvement. If this is important to you, file a support request with Autodesk so they know and perhaps they will adjust the way the tool works (the method Brian Mackey and I developed has the same issue by the way).

I WANT YOU TO MAKE THE SURFACE LOOK PRETTY!!!!!

Yes, we’ve all heard it before, Civil 3D makes contours that sometimes look like the recording of an earthquake on a Seismometer:

Seismometer Recording

Seismometer Recording

Really, it’s not the fault of Civil 3D, it’s the data. Add the same data to any other civil design program and you’ll get the same results. This seems to crop up quite a bit when you have cross grades. In the following image you can see that there are two roads going opposite directions and this is where the jagged contours are coming from:

Jagged Contours

Jagged Contours

No contractor would build it this way so, let’s see what our options are.

Option 1: Smooth the Contours

You can smooth the contours of the surface. In the style the surface is using, you can toggle on the option to smooth the contours. This is a great way to make a drawing “look pretty”. It will take the contours and smooth them out. This is only editing the display of the surface. If you have a profile through this area, smoothing contours does nothing to the profile because we aren’t smoothing the surface, we are smoothing the display of the surface.

To smooth the contours, go into the style the surface is using and, on the contours tab, toggle the option to smooth the contours to True. Once you have this toggled on, you can select the type of smoothing you want to apply to the surface as well as how aggressive you want the contour smoothing to be. Play around with these settings and see what looks best for you. There isn’t a correct setting for this because your goal, when smoothing contours, is to make the contours look pretty.

Contour Smoothing Options

Contour Smoothing Options

And here is the same area of that surface with the contour smoothing option set to True, the Smoothing Type set to “Add Vertices” and the contour smoothing maxed out.

Surface with Smoothed Contours

Surface with Smoothed Contours

There are some things to be concerned with when smoothing contours, you are sacrificing the accuracy of the contours to make them “look pretty”. If you have a spot elevation that happens to fall very close to a contour or perhaps a point that was used in the surface creation that’s really close to the contour elevation, you might see some discrepancies. In the following image, I placed a spot elevation and snapped to the contour and you can see it’s not the exact same elevation as the contour:

Smoothed Contours Labeled

Smoothed Contours Labeled

Another issue with smoothing contours is you might end up with contours that cross each other. You’ll see this sort of thing primarily where you have some really steep areas such as retaining walls.

Crossing Contours

Crossing Contours

Anyone that’s done any amount of surface modeling knows this is not allowed.

The last issue that I’m aware of with smoothing your contours is, it’s all or nothing. You can’t smooth just a portion of the contours of your surface. This is because it’s a part of the style.

Option 2: Smooth the Surface

The other option is to smooth the surface directly. This is an edit that is done to the surface and is found in the same place you can raise/lower the surface or paste in another surface.

Smooth Surface Command

Smooth Surface Command

There are two options when smoothing surfaces, “Natural neighbor interpolation” and “Kriging”. I’m not going to go into detail on how the different methods work or what settings to use. You’ll need to read the HELP FILE and do your own research to find out which method works best for your situation. In this example, I’m going to use the natural neighbor interpolation method.

Smothing Options

Smothing Options

So, how does this differ from smoothing the contours? Well, when you smooth contours, you are smoothing the display of the surface. When you smooth the surface, you are actually editing the surface and not just the display. Here is an image of the surface with the smoothing edit applied to it:

Smoothed Surface

Smoothed Surface

As you can see, the contours look much different then when the contour smoothing was applied. If you take a look at the triangles of the surface, you can get a better idea of what happened here (I did a 5′ grid in this example):

Smoothed Surface Triangles

Smoothed Surface Triangles

A couple things to note here, I didn’t smooth the entire surface, just the  area that needed it. Second, any data that was added to the surface was not modified in any way at all. If there are points, or breaklines, or corridors, or gradings, they are preserved (including the triangulation along the breaklines). This only affects the way the triangulation in the areas between data are calculated. Basically, instead of doing a straight grade between one point and the next, it rounds it out.

Something to be aware of, this can add a LOT of data to your surface and can make it very slow to work with so play around with the settings and get the results you want without adding too many points to the surface.

Hopefully this helps out when someone is complaining about your ugly contours!

Civil 3D uses a Triangulated Irregular Network (TIN)  for surface models, just like every other piece of civil engineering software that I’m aware of. There a  couple of major limitation to a TIN that you should be aware of. First, every single horizontal location (i.e. every x,y coordinate) can have only one elevation. This means no vertical faces and no overhangs or undercuts. The other limitation is since it’s made up of a bunch of triangles, you can’t have curves in your surface. If you have curved data that you want to add to your surface, you must approximate this with straight line segments, and this is where the mid-ordinate distance comes into play.

What the Mid Ordinate Distance Is

When you add data to your surface, one of the options is the mid-ordinate distance. What the heck is the mid-ordinate distance? Well, it’s the distance from the midpoint of a curve to the midpoint of the arc.

Mid Ordinate Distance

Mid Ordinate Distance

When you add something like a curve to your surface as a breakline, boundary, or contour; the surface cannot follow the curve so it uses the Mid Ordinate Distance to approximate the curve. Basically what happens is C3D will start at the end of the curve and draw a line to another point on the curve so the mid ordinate distance between those two points on the curve equal what is set in the dialog box.

Mid Ordinate Calculated

Mid Ordinate Calculated

As you can see in the image, there is a little bit left over at the end, when you add this to a surface, you don’t want that little bit left over so Civil 3D then evenly distributes the number of points added to the feature along it. This will result in a final Mid Ordinate Distance slightly less then what was calculated.

Mid Ordinates Distributed Along Curve

Mid Ordinates Distributed Along Curve

So, instead of adding just the ends of the curve to the surface, the Mid Ordinate Distance allows us to determine how many points along the curve we want to add.

What Should You Set It To?

Now that you know what it is, what should it be set to? In the default template, it’s value is set to 1 drawing unit (1′ in the imperial template and 1m in the metric template). Is this value too big? Too small? Or just right? Let’s think of this in a different way. Don’t think of it in the abstract Mid Ordinate Distance way, think of it instead as “How far away from my data should I allow my surface to be created?” If you set the Mid Ordinate Distance to 1′, then the triangle of your surface can be up to 1′ away from the actual data. It’s your call, is this acceptable or not?

Here’s how I like to figure out an acceptable Mid Ordinate Distance. What is the smallest distance between any two breaklines you’ll have in your surface? Are you modeling a haul road for a mine? Or are you modeling curb and gutter for a commercial parking lot? In my experience (primarily land development) I use a lot of curb and gutter. When I model the flow line and the top face of curb in a standard curb and gutter, that’s a horizontal distance of 2″. Take that smallest distance and cut it in half to get your desired Mid Ordinate Distance, in this case 1″. Since 1″ is about 0.08333 I will typically us 0.1′.

Can I Change the Default?

Well, of course you can! Ok, let me rephrase that, if you are using Civil 3D 2010 or later you can. On your toolspace, go to the Settings tab and expand out Surface and Commands:

Command Settings Location

Command Settings Location

As shown in the image, there are three commands (at least that I know of) that can have the Mid Ordinate Distance set, AddSurfaceBoundaries, AddSurfaceBreaklines, and AddSurfaceContours. Right click on the command you want to change and choose Edit Command Settings. In the command settings, expand out “Add data options” and change the “Default mid-ordinate distance” setting.

Mid Ordinate Distance Defaults

Mid Ordinate Distance Defaults

Hopefully this will help you understand what’s going on with this setting and, have a Merry Christmas!

Checking comments on my blog this morning I ran into this question:

Thank you very much for nice post. I have one more query. I want to display elavations of contours for each contour line at some fixed interval. I don’t want to draw lable lines. Is there any way to do that. If u know it please help me

Most likely they want an automatic contour labeling routine but it got me thinking, what about labeling every third contour? Or every seventh? Or every whatever the heck you want contour! It’s pretty simple, you just need an expression that will check the interval and then control it’s display. Here’s how to do it.

For this example I am going to label every third contour line. First, create an expression. This expression will see if the contour is at the interval. If it is, then return the contour elevation. If it’s not, return a negative one. To create the expression, expand out Surface on the Settings tab of the prospector, then Label Styles, and finally Contour. Right click on Expressions and select New…

New Expression

In the new expression dialog box give the expression a name and a description. Have a little forethought on this as you can’t go back and rename or change the description of the expression. The actual expression itself will look something like this (remember I’m doing this for every third contour):

Expression Settings

So, what does this expression do? The test in the IF statement is “{Surface Elevation}/3=TRUNC({Surface Elevation}/3)”. This tests to see if the contour is the third contour or not. If this test is true (the contour IS divisible evenly by three) then it returns the contour elevation, if it’s not, it returns -1. This -1 is key to how this expression works in the label style.

And make sure to format it as an elevation.

Now that the expression is created use it in your label style. You can create a new style or copy an existing style. In the style composer, edit the style. On the Layout tab, edit the contents of the text component. Remove the current text from the right hand side and insert your new expression into the label. When you do this, the important part is to set the “Sign” value to “hide negative values”. This way if the expression returns -1 it will, basically, not display anything at all.

Applying the Expression

Once you have done this to all label styles involved in your labeling process (i.e. major, minor, user, etc.) your drawing will look something like this:

Expression Used in Labels

You want to change the interval? Modify the expression or create a new one for that interval. Want to adjust the base of the calculation? Simply add a number in the surface expression to adjust it. For example, I want to label contours 1, 4, 7, and 10. The expression would look like this: IF(({Surface Elevation}+1)/3=TRUNC(({Surface Elevation}+1)/3),{Surface Elevation},-1) – Notice that I added 1 to the first two {Surface Elevation} values to adjust the test (don’t add 1 to the last one!).

Note from Brian: There’s some new functionality in the 2015 release regarding images. Check it out HERE.

I’m constantly amazed at how many people import data from Google Earth into Civil 3D and then complain about how horrible the data is. There are two primary issues that I’ve seen when importing data from Google Earth. First of all, the imagery is inconsistent at best. The guys over at Being Civil wrote up a nice post about this issue HERE if you are interested (also, the images come in black and white). The surface data that you bring in is very limited. Sure, you can pick anywhere you want but you are limited to importing 5,000 points and, if you have a large area, that’s not very much data at all (I recently downloaded a DEM file with over 2.5 million points, now THAT’S data!). So, instead of relying on Google Earth, go out and get the data yourself! You’ll be much happier with the results.

For those of you with projects in the United States there is an amazing resource that I was familiar with but never really investigated much, the USGS Seamless Data Warehouse (I was playing around with the Autodesk Infrastructure Modeler and looking for data). You can find it at seamless.usgs.gov. Here you can browse a map to find your project location and download orthoimagery (i.e. aerial images) as well as surfaces (DEM files). You’ll need to create an account to download the data but it’s free.

Using the Seamless Viewer

When you get to seamless.usgs.gov, on the left hand side, there is a panel and on this panel, is a link to the Seamless Viewer (you can access it HERE if you like). It looks a little something like this:

Seamless Viewer Link

Once you click on this, it will take you to a map showing the entire United States (well, most of North America actually). Draw a rectangle around where your project is (you’ll see the state boundaries so use that as a guide and zoom in on the state the project is in). Once at the state level, you’ll probably need some assistance locating your project area. On the right hand side of the map, you can change what is being displayed in the map. By default (at least for me) all it showed was the digital elevation data. That really didn’t help me find the area I was looking for (Colorado is a big state, not as big as Texas of course, but still big) so I toggled on a few options to help me locate my project. The ones that seemed to help me the most were the Orthoimagery, the Transportation, and the Places (Names). As you can see in the following images, it makes a huge difference.

Before Editing the Display Options

After Editing the Display Options

Once you get zoomed in on the area of interest, you need to tell the Seamless servers what it is you want to download. On the right side of the map where the Display options are located, switch from Display to Download.

Download Options

In this case, I chose to download the NAIP (National Agriculture Imagery Program) Orthoimagery as well as the 1/3 second DEM from the National /Elevation Dataset. Once you’ve set what it is you want to download, you need to specify what part of the map that you want the data for. To do this, use the tools on the left side. I chose the “Define Rectangular Download Area” option.

Download Selections

A new window will pop up with links to download each file. The files you’ll get are simple .zip files. Once you unzip them you’ll get a ton of data. For the DEM, the files you need are the ones that end in .adf. Just keep all these files in one location and you can then create a surface from them in Civil 3D. The images will have a lot of files as well but really the only ones you need are the .tif file and the .tfw file. The .tif file is the actual image itself and the .tfw file is the world file. The world file lets Civil 3D properly locate it in your drawing. And honestly, I don’t think you really need the .tfw file as .tif files can have coordinate information embedded into them (aka GeoTIFF). I would still just leave them together to be safe.

Download Files

Using the Data in Civil 3D

Once you have the data, you need to add it into Civil 3D. First thing you want to do before adding in this data is to make sure your drawing has a coordinate system assigned to it. If you aren’t familiar with this, simply right click on the drawing name on the settings tab of the Prospector and choose Edit Drawing Settings. On the Units and Zone tab, assign an appropriate coordinate system to your drawing. If you aren’t sure what to use here, check with your surveyor on the project.

Coordinate System in Civil 3D

To bring the DEM file into Civil 3D, create a surface and add the DEM file as data. I’m not going to get into the details in the post as I’ve already talked about how to bring DEM files in to Civil 3D. You can read it HERE if you like. When you add the DEM file, use the coordinate system code LL83. Also make sure you read the comments as you’ll need create the surface in a metric drawing and use LandXML to bring it into a drawing that is in imperial units.

To bring the images into Civil 3D, use the Map Image Insert command MAPIINSERT (yes, two I’s in there). This will bring the images in georeferenced.

Conclusion

Sure this process takes longer then importing from Google Earth but think of it this way, “You get what you pay for”. In this case, you’re paying with time. Importing from Google Earth is fast but you get very poor data. Getting the data yourself takes a bit longer but you get MUCH better results. Check out this example, in the following image you can see where four of the images downloaded from the Seamless server line up and it’s REALLY close to being exactly matched up (I can’t see any offset or other error personally). Compare that with what you get out of Google Earth.

Image Overlap

If anyone has data sources similar to this for other countries, comment here so others can find them.