Wednesday, January 23, 2013

The Power of 10: Filtering Contours with Map

This is a reprint from an earlier blog (February 28, 2012) that is no longer available online.

The Power of 10: Filtering Contours with Map

I was recently working with a client, and he was working on a project where he needed to show contour lines in the area as a reference. The particular job didn’t need any kind of surface, just show contour lines as a reference. Luckily, the local city had complete coverage of his project area. The data was 1’ contours in an ESRI shape file. That was way too detailed for the project, so he needed a way to thin down the contour lines (no AutoCAD Civil 3D needed here – no surface or analysis needed). As a matter of fact, he really wanted only 10’ contours. What he needed was a query to filter out the other contours. In this case, identifying the desired contours is pretty easy – they all end in 0.
Some folks create their contour data and using a string (text) data type. In such a case, it can pretty easy to do in a single step – use the substring function (from the Text Function list) to select all the features where the final character of the elevation attribute is equal to 0 – be sure to add quotes to the 0 to show text rather than numbers.
When the field is numeric, there is a just a little more to do. In this case we need to find all the contours whose elevation is divisible by 10. So how do we do that in a query? The trick is to divide the value by 10 and evaluate the remainder. If the remainder is 0, we know that it is divisible by 10. To do this in our AutoCAD Map, we first create a calculated field where we capture the remainder and then run a filter query to select only the values that have a remainder of 0. Let’s take a look.
First, right click on the layer to Create a Calculation.
Then when the dialog box appears (this should look familiar), give it a meaningful name, go to the math functions and select remainder, and then replace the number place holder with your elevation field and the divisor by 10. Click validate to ensure the calculation doesn’t have any problems (keep in mind this can only check for appropriate field types vs actions – it has no way to check if this is what you really want to do) and then ok.Check the table to take a look at the result to see if it gives you the result you’re looking for.
Now that we have the remainder field, we can use it to filter the data. In the Create Query dialog, set the remainder property equal to 0, validate and hit ok.
Now your contours should only show those 10’ contours, and we can see how to use calculations can enhance our ability to select and show data.
Check out my video of the process.

No comments: