Wednesday, May 16, 2018

Leveraging GIS Data in Civil 3D: Querying Data Between Files

Following up on last week's post on Leveraging GIS Data in Civil 3D, this week I'm covering how to query data between drawing files using Civil 3D's built in Map functionality. As I mentioned in the previous post, this blog post also applies to Map 3D software as a stand alone and to the new 2019 AutoCAD Only One with the Map extension added in.

To begin, I already have a drawing file setup with GIS data from a county source. This file can be in whatever coordinate system deemed necessary to match the data and I had used the MAPIMPORT command explained in the previous blog post.


However, when clicking on contours, you can see that the AutoCAD property of the contours do not read the proper information from the Object Data table, thus in this post I'll demonstrate how to query the data over to a new drawing file on the same or a different coordinate system, apply a spatial filter, and alter the AutoCAD properties of the objects to inherit the Object Data information.

For this example, I am using the Elevation property, but this can be done for almost any of the AutoCAD properties about the objects.


In a new drawing, I've setup my project coordinate system and brought in the Bing imagery for my site and located where I wanted contour data. At the bottom of my screen you can see the coordinate system. By the way, by default this coordinate system in the status bar is turned off by default. To turn this on, you can use the command MAPSTATUSBAR.


 Next, to use the Map querying functionality, we need to turn on the Map Task Pane. Use the command MAPWSPACE to turn this on. You should see something like below.


Using the MapExplorer tab of the Map Task Pane, right click on drawing and select Attach...


 On the select drawing to attach dialog, you'll find that this is not as simple to use as other dialogs. Essentially you have to setup a drive alias to your file(s) location and then tell this dialog to look at that drive alias. To do this, select the button circled in red below.


 Here you'll need to setup the drive alias and browse to your actual path. Then select Add to add the alias to the drive list. Select close when done.

 

 Now on the Select drawings to attach dialog, you should be able to select your drive alias and it will take you to your file(s) location.


Find the drawing(s) you would like to reference, and select Add. The drawing(s) will be added to a list. Select Ok when done.


In the Map Task Pane, you should now see your drawing attached. It's important to note that when doing this, the file is opened and a file lock is placed on the file. Once completed, you will need to make sure the file(s) are detached to release the locks.




Next, we are ready to define our query of data, thus on the Map Task Pane, on Map Explorer tab, locate Query Library and right click, select Define.


The dialog below will appear to allow you to build your query. The top white box is your current query information. The bottom left Query type allows you to query a location of the drawing(s), specific object property information, Data, and SQL calls on the tables. Query Mode allows you to Preview, Draw, or Report on the query. Options allows you to do some additional items like altering properties.

For this example, let's start by selecting the Location... button.


Here you'll be prompted to select your Location Condition. For Boundary type I'll use Boundary, with a selection type of Inside. This should bring in the data inside a selected Polyline. If you want all the data, just choose All. For some of the boundary options like Polyline and Window, you'll need to select the Define button at the bottom and the define the area or object. Select ok when done.


Next, you'll be back on the Define query dialog. Choose Properties. Here we'll tell it to only look at objects on a specific layer. We can choose layer, then Values, and select our layer. Choose Ok.


Back on the Define query dialog, we now want to specify what properties we would like to alter. Select the Alter Properties button. Here you can alter many properties at once. The white box at the top of the dialog shows your Current Property Alterations. Below that you have options of what you would like to alter (FYI, you can even alter Text to display specific object data property information!).

For this example, we'll choose Elevation, and then choose the Expression button. The expression dialog will appear and we'll need to select the corresponding Object Data Table and property we want to pass over. In this case it's the Walton_Contours, ContourElev property. Select Ok on the Expression dialog.


You should now see your expression like shown below. Click Add to add this to your current property alterations.


The property alterations dialog will now show the information like below. Either add more properties to alter, or choose Ok when done.


Back on the Define Query dialog, we should see something like below. Be sure to set the Query mode to Draw, and make sure the Checkbox in Options next to the Alter Properties is checked. This controls whether the Alter Properties runs or not. Choose Execute Query when done.


The contour data should now come over and when selecting a contour you can see the Object Data table information has been applied to the AutoCAD elevation property... for every contour in your query! Again, this can be done for many objects and properties all at once and could be very helpful to translate your GIS data appropriately.


Lastly, as I mentioned earlier, be sure to detach your file from the Map Task Pane to ensure it is unlocked for others to use.


It's important to note that this is just an example of one type of data. The options here are nearly endless with the what data you are using and what can be queried and fully brought into functional AutoCAD objects from GIS data referencing the GIS Object Data tables. It's also important to note that I am not aware of any ways to apply GIS Object Data to Civil 3D objects - the Alter Properties only works with the AutoCAD Properties available and does not allow for extended Civil 3D information - nor does it allow for access to Property Sets which I believe could be beneficial for Civil 3D 2017 and greater which provides access and labeling of Property Sets.

No comments:

Post a Comment