<If you don’t like reading, there’s a video at the bottom of the post.>

I’ve been playing around with InfraWorks for a bit now and I’ve always meant to but never got around to figuring out the Style Rules until now. All I’ve seen with regards to the rules is how to randomize your display. Well, I don’t want to randomize it, I want it to be very specific! I want my offroad roads to look like offroad roads, I want my highways to look like highways, and I want my local roads to look like local roads. Well, read on and see how it’s done! It’s actually a lot easier then I expected.

This is what I’m getting, all the roads look the same:

What I Get

What I Get

And this is what I want, the roads stylized based on their classification:

What I Want

What I Want

First of all, you need a data source with information in it that you’ll use to stylize the InfraWorks objects. In the example I’m using, I downloaded the data from the GIS department for Loveland, Colorado. To get a quick idea of the data that’s in the shape file for the roads, I attached it to a Civil 3D drawing (just drag the .shp file into the Civil 3D drawing) and opened the data table. This particular data source has a field called ROAD_CLASS. Some of the values for ROAD_CLASS are: RAMP, LOCAL, HWY, CLCTR-MINOR, etc.

Road Classification Data Field

Road Classification Data Field

This is the data that I want to use to determine the style of the road. I’ve broken the process up into three steps, adding the data to the model, creating the style rule, and applying the style rule.

Adding the Data to the Model

I’m not going to get into how to add the shapefile to the model here, what I’m going to discuss is how to get that particular piece of data from the shapefile and add it to each road in the model. When configuring the data source (this can be done when it’s added or after the fact if needed), you’ll need to tell InfraWorks to include the piece of data you need. In this example, I’m going to add it to the description of the road. On the Common tab of the Data Source Configuration, simply hit the pull down to add the ROAD_CLASS field to the description of the roads.

Adding GIS Data Fields to InfraWorks Objects

Adding GIS Data Fields to InfraWorks Objects

Note: If you want to add the data to a different property, you can do this on the Table tab of the Data source Configuration dialog box.

Close and refresh and now we are ready to create the Style Rules.

Creating the Style Rule

Now, we want the style of these roads to be determined from the description so, let’s create a Style Rule. To open the Style Rules, select the big orange I in the top left of your model (I’m using 2014 R4 for this), select the button just to the right of it, “Create and manage your model”, and then select Style Rules.

Open the Style Rules Panel

Open the Style Rules Panel

In the Styles Rules, select the tab on the left for the feature you want to add the rules to (in this case I’m going to choose Roads) and then add the new rule by selecting the green plus. Give the rule a name (I’m using the roadway classification here) and then click OK.

Add a Rule

Add a Rule

Once the rule is added, double click on it to edit the rule. In the Rule Editor, you can change the name of the rule and add a description to the rule if you would like. The important part here are the “Expression:” and “Styles:” sections.

Rule Editor

Rule Editor

In the “Expressions:” section, select the Edit button to edit the expression (sounds obvious, doesn’t it?). In the Create Filter Expression dialog box, double click the property you want to filter on (in this case expand out Common and choose Description). This will add that property to the expression. Now, I only want this rule to be applied to the roads with a specific description so, type an equals sign “=” in the expression after DESCRIPTION. Finally, add the property to the expression. If you know it, you can just type it. If you want to select one of the properties that is in the data source, on the right hand side, find the property and then double click on the value to add it to the description.

Create the Expression

Create the Expression

After hitting OK, you’ll be back in the Rule Editor. In the “Styles:” section, simply add the styles you want this rule to apply. If you want them all to be the same, simply add the one style you want. If you want them to vary, you can add multiple styles and then adjust the probability to force one style to be added more often then another.

Completed Rule

Completed Rule

Now continue the process until you’ve added a rule for each roadway type you have.

Rules Created

Rules Created

Applying the Style Rule

This is the easiest part, once the Style Rule has been created, all you need to do is click on the Run Rules button at the bottom of the panel.

Run the Rules

Run the Rules

There are also options to export and import the Rule Styles so you don’t have to recreate them every time you need to do this.

Now get out there and have fun playing around with InfraWorks!

Advertisements

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!

A while back, I did a post about bringing DEM data into AutoCAD Civil 3D (you can read it HERE if you are interested). In the comments, people have asked several questions and have had some issues. One of the issues is, you have to know what coordinate system the DEM file is using. Another is that, no matter what coordinate system you are using, the DEM comes in as though the elevations where in meters (and will then convert those meters to feet).

Well, all that’s about to change. If you have the Autodesk Infrastructure Design Suite (Premium or Ultimate) then you also have Autodesk Infrastructure Modeler (AIM). You can use AIM as a DEM to Civil 3D surface converter. Simply import your DEM file into AIM, export to a .imx file, and then import that into Civil 3D.

Open up AIM and create a new project. Give it a name and a place to save it. Keep the coordinate system as LL84 (there’s no need to change it) and leave everything else the way it is.

Create a new project

Once the project is created, import the DEM file into AIM. This is done through the Data Sources panel. Expand out the different data sources and choose “Raster” as the data source. Browse to your DEM file, open it, and then Refresh the data. You will now have a beautiful surface in your model.

Import DEM as Raster

Refresh DEM

Now that the DEM is added to your model, export it out to Civil 3D via the .imx file. In the application menu of AIM (that’s the purple I in the top left corner of the application), choose the Export menu and then “Export to IMX”. In the Export to IMX dialog box, choose to export the entire model, and give it a file name. AIM will choose an appropriate coordinate system so just leave that alone. Depending on the size of the DEM file, this could take a few minutes.

Export to IMX

Once the .imx file is created, open Civil 3D. To import the .imx file, it’s important to remember to assign a coordinate system to your drawing. If you aren’t sure how to do this, click HERE. Once in Civil 3D choose the Import IMX command (it’s on the Import panel of the Home tab of the ribbon or type IMX_IMPORT at the command line). Simply browse to the .imx file and bring it in. Because both the .imx file and your drawing have coordinate systems assigned, the DEM file comes in at the correct location and at the correct elevation. You may want to change the name of the surface as well as the style but, you now have a beautiful DEM file in your drawing and you didn’t ever have to know what coordinate system it was using!

Import the .imx file into Civil 3D

And if anyone is wondering, the DEM file I used while creating this blog post created a surface in Civil 3D with almost 4 million points.

Surface Properties

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.

So, you’ve heard that there is a lot of free data that you can use in your GIS software.  Well, some of that free data, you can also use in Civil 3D.  Civil 3D is built on top of MAP so all that free GIS data, you can use as GIS data in Civil 3D.  But, I don’t want to use it as GIS data, I want it to be Civil 3D data!  Well, if you have a DEM (Digital Elevation Model), you can add that to a surface and away you go!  Follow the link to find out more.

(more…)