Category: Interoperability

Creating AutoCAD Text from Geospatial Datasets

In this tip, I’m going to convert attribute information from a data set in ESRI Shape format, and create a text label from that attribute. There are a couple of techniques, but in this case, I’ll show a quick and easy technique to create AutoCAD text labels from a connected shape dataset using an FDO connection.

Start with a new drawing, assign the coordinate system and create a connection to the data set to label.

Add the data to the map, and the dataset will show up in my Display Manager.

Once the data connection established, create a style and hit the feature label option. This will open the Style Label dialog box where all the settings are to get the labels to look the way you want.

 

Going down the dialog box, set the Multiline Option (the Advanced Placement option will set the text to follow the line, which you may want for certain conditions, but the text can end up in separate text entities for every letter – that may be ok – it depends on what you are looking for).

The next item is to identify what property (attribute item) you want to use for your label. If you have an attribute that is exactly what you want, you can set it and be done. In some cases, you may want to modify the value or even combine several elements of the text. To add pipe sizes, take the size and add an inch symbol (the double quote) – so an 8” line will read 8”. You could add material so the label reads 12” PVC, or if doing street names, you might want to combine the street number, direction, name and type to get a complete street name. To modify this, select expression here. This will open the Map Expression Builder dialog box.

There are a lot of options for creating text labels from data, calculations, or other elements. In this case, I want to place some text elements together. The function to combine text is concatenate, which I can find under the text functions under Concat.

Selecting the function places the text and format in the expression window. The function works on the elements contained in the following parenthesis, and the bracketed text property are place holders for the text elements. To get the pipe size and combine it with an inch symbol, replace the first Text Property with the value for the size, and the second with the “ symbol (surrounded by single quotes to show it’s a text value – ‘”’). You can continue to add pieces of text until you get the desired label. To add attribute values, such as the size, use the Property menu and the list of attributes will be there sorted by the type of field. I’ll select the size, and complete the expression – Concat ( SIZE , ‘”‘ ). For street names, an expression might be concat( ST_DIR, “ “, ST_NAME, “ “, ST_TYPE) where the “ “ is used to add spaces between the fields.

You can use any combination of data fields and other elements to create a label with this expression process.

Once the expression is set, you can set the display parameters such as size, color and font. Remember with the size, Map Space is scale relative to the model and set the height to a specific value, while device space is relative to the monitor, or view, and will change the physical height based on the zoom scale.

Once the labels are set how we want them, we can go to the Display Manager and select Save Current Map to DWG from the Tools menu.

After saving to a new drawing file, we can open the file and the labels are now standard AutoCAD text items along with the roads. The process actually takes more to write about than to actually do.

Next post, I’ll go the other direction. I’ll show how to grab labels and turn them into attributes.

Losing Your Religion: Interoperability with AutoCAD Map 3D and ESRI, Part 2

A little while ago I started this interoperability discussion by discussing the similarities between CAD and GIS, primarily Autodesk’s AutoCAD and ESRI’s ArcGIS. Now I’ll talk about the critical differences between them, or at least the data formats.  These differences are critical to understanding how to manage interoperability.
There are two primary areas of difference.  One is the data structure paradigm, and the other is the graphic representation. AutoCAD drawings and ESRI data sets store data in fundamentally different methods. They are both forms of databases that store information about the location, properties and appearances of the various objects, but because they have substantially different requirements, they have to organize the data differently.
 

Data Structure Paradigm
CAD is used for all types of drawing. The CAD drawing file is essentially an object-oriented database which stores objects sequentially (essentially as they’re drawn). Each row of data will represent an individual CAD primitive object.  The structure of the data and the number of elements is dependent upon the type of primitive. For example, a point is going to carry a single coordinate pair (X,Y) for its location while a line will store two coordinate pairs – a start point and an end point.  A curve will have a start point, an end point, and a bulge (or curve) factor. Along with that, there are additional data elements describing the color, line type, layer and other properties.

Entity ID Line St Point End Point Layer
Entity ID Point Ins Point Layer Color
Entity ID Block Ins Point Layer Color
Entity ID Arc St Point End Point Bulge

An ESRI GIS dataset, whether it is a shape file, geodatabase or personal geodatabase organizes the data into more formal structures, in the form of tables (this is simplified to a conceptual level – each of these data formats include several files or tables to complete the dataset, but are not really germane to the discussion). Different primitives, such as points, lines and polygons can’t reside in the same set of tables. In addition, the number of data elements in each row will be consistent with the dataset. Points representing valves will be in a different table than the lines representing the pipes they’re attached to. The tables will be divided based on some set of business rules to organize the data. In the ESRI terminology, this is essentially a Feature Class. For example, water, storm and sanitary sewer lines may all be in one table, or they may be divided into 3 or more tables. The division may be due to organization, or due to the different information needed for each group. Many times within each Feature Class, there will be a further subdivision of objects, such as high-voltage conductor and low-voltage conductor, called a Subclass. Typically the subclass will be the level of organization used to symbolize the objects. The result is a very structured organization of data.

Feature Class (Pipes – Lines)    
ID Shape (BLOB) SIZE MATERIAL IN USE
ID Shape (BLOB) SIZE MATERIAL IN USE

 

Feature Class (Vegetation – Polygon)  
ID Shape (BLOB) SPECIES AGE AVG DBH
ID Shape (BLOB) SPECIES AGE AVG DBH

The analogy that I typically use, and it seems to fit, is that the data sets are like a collection of coins. My AutoCAD file is like a pile of change and my ESRI data file is like the same group of coins all organized into paper tubes.
coins

 

 

The take away from all of this is that an AutoCAD drawing will store multiple data types in a single drawing file, while the ESRI data sets will store multiple data types in multiple tables (and/or files). This is a critical point to managing interoperability.

 

Graphic Representation
The other major area of difference is with the graphic representation. The AutoCAD drawing includes information regarding the appearance of the objects. For example, a line will include the color, line type, and thickness. Each of these properties is inherent in the primitive object. These properties define how AutoCAD will display the file. If I pass the file to someone else, and they open it, it will look the same.
ESRI datasets are a different case. The datasets are not related to the appearance of the data. The appearance is left up to the application at the time of display. ArcGIS, for example, stores the appearance of a map in a Map document, which contains pointers to the data, describing what data to select (allowing a subset of the data through a query) and how to display it. It is the map document that contains the symbolization information, such as linetype, color and stylization.

viewing
The Result
These two differences present the primary difference to interoperability. Neither one nor the other is inherently better – they have different ways of achieving similar results.   The data organization presents some challenges when bringing CAD data into GIS tools, for example, when reading an AutoCAD DWG file in ArcGIS, it reads the data as if it were ESRI datasets, and groups objects by their primitive forms, such as lines. That’s different than the way CAD users think of and manage the data. Additionally, CAD drawings typically contain information that doesn’t fit into the GIS data model. The separation of the data from the symbolization is what allows GIS systems to display the same information is many ways depending on the view or analysis needed. This also makes it a little more difficult when transferring data between systems. There is no direct method within AutoCAD to read the Map document to get the shortcuts and symbolization and replicate an ArcGIS map without recreating the symbolization. In most cases this is not really an issue because the data is the important part, although it can be problematic when you want to reproduce the entire map.
There are some other differences between systems that are important to be aware of, such as shape files not dealing with arcs (causing arcs to be broken into many small lines), and single or double precision data differences. These are important to be aware of, but not as critical to the basic interoperability of the systems.

One of the reasons I like working with Autodesk’s AutoCAD Map 3D  product is that it provides me with both worlds. It is an AutoCAD drawing, and with the Feature Data Objects connectors, I can work with the ESRI datasets natively without having to make any changes in the way I work with these disparate data types.

In most cases, there are business issues that interfere with interoperability that have a much greater impact than these technical software elements. I’ll explore those in a future blog.

Happy GIS Day! Here’s some Arizona GIS Data Sites

CADsoft Consulting’s CAD Camp 2009 is well underway.  We had a very successful Architectural/BIM day yesterday, and the Civil day is in full swing. Tomorrow will be the Geospatial Day (so it doesn’t interfere with any GIS Day activities). This morning we’ve had a presentation from Autodesk’s Civil 3D maven, Lucy Kuhns, and our own Ron Coulliard is doing a workshop on grading as I type. During Lucy’s presentation, I was asked about local Arizona GIS data, so I promides to share some of the sites I use/am aware of. The list is by no means exhaustive, and there’s some dupplication within the sites, but here you go anyway. I’ll continue to identify sites I run across in the future. If you’ve got some good ones you want to share, add them to the comments or email to me and I’ll add them to the list.

GIS Data Sites for Arizona

Arizona State Cartographer’s Office 
They maintain the Arizona GeoServer, with aerial photos and statewide features served through web mapping services (WMS) and web feature services (WFS). They also maintin links to other data sources throughout the state

The AGIC (Arizona Geographic Information Council) GeoData Portal
AGIC is a state sponsored group working with GIS across the state. They sponsor an annual GIS educational conference every year. We just finished the 2009 conference in Tucson. There was great attendance. I presented 3 hands on worksops this year.  They have County boundaries, tribal boundaries, cities, wilderness areas, political boundaries, voting districts, school districts, census information, environmental and natural resource data, interstates and roads

US Fish and Wildlife
USFW maintains larger scale data sets covering National Wetlands Inventory and area boundaries

U of A Library
The U of A Libraries maintains the Arizona Electronic Atlas and the Arizona Regional Image Archive (ARIA) as well as links to other data sites

ASU
The ASU Libraries also has spatial data and links available

ADEQ
Arizona Department of Environmental Quality (ADEQ) has water quality data, surface, drinking and groundwater

Local division sites

Maricopa County
The County Assessor’s Office GIS Department maintains data for the county including parcels, detailed topographic data, floodplains, and survey network.

Pima County
Pima County is really one of the long runners in GIS. They have had data available for as long as anyone in the state. They maintain over 273 data layers in ESRI shape files as well as landbase section maps in AutoCAD format.

City of Phoenix
Phoenix has an extensive collection of GIS data.  They have Engineering Quarter-Section maps in DXF format CAD files

Nationally-based sites

US Forest Service

FEMA
The Federal Emergency Management Agency maintains flood hazard data sets which are available as GIS data sets or through a Web Mapping Service (WMS) 

NSGIC
The National States Geographic Information Council maintains an inventory of data and its currency in the Ramona GIS Inventory. Arizona’s page is here:

Natural Resources Conservation Service (NRCS)
The NRCS maintains the Soil Data Mart with soil data available by state. They also collect other data such as water supply and snowpack

United States Geological Servey (USGS)
The USGS maintains large scale data sets for the US. They have digitial orthoquads and photos, land cover, elevation model and other data sets.

US Census Bureau
The Census maintains census and popluation data for the US

United States Department of Agriculture

USDA has Forest Coverage

Geography Network
The Geography Network maintains various spatial data sets for the US

ESRI Geoportal Extension
ESRI has a beta site with downloadable GIS data

National Center for Atmospheric Research
Atmospheric data for the US

 

New Mexico

Lucy Kuhns mentioned the New Mexico Resource GIS program site. Here’s the link:
http://rgis.unm.edu/

Losing Your Religion: Interoperability with AutoCAD Map 3D and ESRI

I’ve been speaking at conferences for several years about CAD and GIS interoperability. It’s one of those topics where there’s a lot of interest and a lot of misinformation. Or at least, it seems to be much more difficult than it really is. I’ve been moving data between both systems for years, with very few real challenges. What I’ve found, is that the real issue is not the technical aspect of moving data back and forth, but the differences in how the software is generally used. AutoCAD (and other CAD systems) are primarily used for doing design work, and GIS (ostensibly ESRI, but it could be any GIS system) is primarily used for managing as-built facilities and systems. The real challenges are working between the design and as-built management processes. In other words, the issue isn’t CAD to GIS, the issue is Design to As-Built.

I’m going to make several blogs here in a series of the issues and some methods to make the process easier. This first post, I’m going to discuss the a bit about the similarities in the technologies. Following that, I’ll be posting on the differences, barriers, myths, and other issues involved.

Both AutoCAD and ESRI are built on basic primitive elements that are combined to create representations of real objects. Both systems include:

Points - a representation of a single location. It could represent a physical object such as a pole, manhole or brass cap in the ground, or it could be a non-physical point, such as a crime scene location or the corner of a property line. In any case, the systems both record a coordinate consisting of an X and a Y and possible a Z (if elevations are being included). The X and Y value could represent any projection or coordinate system, such as degrees of latitude and longitude or northings and eastings from a state plane.

Point

Lines – a representation of of a connected set of coordinate pairs. Every line is going to have a start point defined by X, Y and/or Z, and and end point defined by an X, Y and/or Z. It could represent the centerline of a road, the edge of a building, or a buried pipe.

Line1

The line may be defined the system by coordinate pairs, such as point A and point B, or it could have the actual coordinate values in the line definition, such as this example from AutoCAD (a listing of a line – the start point is the set of parenthesis with the 10 X Y Z, and the end point is 11 X Y Z):

AutoCAD Line

In some cases, for example, ESRI, the actual coordinates of the line are stored within an object “envelope”, which is a rectagle enclosing the object.

Line2

 Polygons – a representation of an area. It could be a representation of a parcel, a building footprint, or an animal migratory zone. It is defined by lines and so by a series of bounding coordinates. Generally, in vector systems (save that discussion for another time), polygons are defined by their boundaries. They could be defined by groups of lines, or it could have the coordinate values built into the definition, simlar to the lines (as shown above).

polygon1

In ESRI, the coordinate pairs are contained in an envelope bounding the entire object:

polygon2

Attributes -  data associated with an object. Associated data could be an identification number, a name, a description of the object, the color, size, diameter, etc. This is what turns a simple point, line or polygon into a representation of a fire hydrant, electric line or county. Attributes may be stored and linked to the object in a myriad of methods. It could be based on a common identifier stored in the object definition and the attribute list, as in a primary-foreign key relationship, or the definition of the object may be created to include certain atribute sets intrinsically. In some cases there may be a mixture of methods. For example, in AutoCAD, objects have intrinsic attributes (such as blocks attributes), extended entity data (attribute values associted to an individual object), or object data (data tables stored internally in the drawing and linked to objects). Additionally, both systems include methods to link objects to externally associated databases to extens the attributes of an object.

objectdata
Understanding these similarities is key to understanding how to integrate these two systems. The next post, I’ll discuss the primary differences between the two.

Breaking Out of the DWG

Professionally, I’ve always been square on the fence between CAD and GIS. The funny thing is that GIS folks always call me a CAD guy, and the CAD guys always call me a GIS guy. Personally, I’ve always believed in using the right tool for the job, regardless of the technology. The best part for me is that I learn from both technologies and apply them wherever it fits. One of those “learnings” has been to break free from the DWG in AutoCAD Map.

Traditionally, when working in AutoCAD, we work in a drawing. The drawing maintains the model as well as any associated annotation, labeling, details, etc. At most we’ll have a group of drawing files, and some external references to share drawings. It’s much like using Word. We work in documents.

Traditionally, working in a GIS is a bit of a different model. While you have views, or map documents (depending on the particular flavor of GIS) your documents are really little more than a collection of links to data with some instructions on symbolizing the data. It really is more like working in a database, like Access, than in a document.
Both approaches provide benefits, so why not mix them? AutoCAD Map 3D allows me to bridge the gap between technologies. I can use my current drawing file as a pointer to various data sets, while having additional drawing information in my drawing file. For example, I can have my model (the actual drawing representation, whether it be a design of a road, or a city water system) linked from external data sources, and have multiple drawing sheets, complete with one or more title blocks in my current drawing. It allows me to have specific views, sheets or plans with project-specific data and take advantage of permanent data stores that are dynamic and updated each time I open them.
DWG from multiple sources
This allows me to use my enterprise GIS as part of my design tools without having to go through a conversion process. The great part is that it doesn’t really matter what my data source is. I can use other drawings through the attach and query tools, as well as Feature Data Objects (FDO) connectors to systems such as ArcSDE, Oracle or MySQL. I’ll blog more on that GIS-Design integration another time. The point being, is that the individual drawing can lose it’s importance and become essentially a snapshot of your model.

ATTACHED DRAWINGSWhen using drawings as your data source, you can either use the ribbon or the Task Pane (as well as the Classic Menus). On the Ribbon, Attach is right on the Data Panel on the Home Ribbon for both task and tool-based workspaces. The Map Explorer tab in the Task Pane provides a visual of the drawings attached – to access the commands right click on drawings.

FDO data sources can be connected using Connect on the Data Panel in the Home Ribbon as well (next door to the Attach commands), or from the data button at the top of the Task Pane.
FDOConnect
The short story is that you don’t have to be a slave to your DWG file, and treating your DWG as a view to your model, you have some real power to take advantage of a whole new range of possibilities. The great part is that this is not new technology (the FDO process is relatively recent). Map has incorporated this capability since it was acquired.

So, unleash the shackles and get connected.

MAPIMPORT – Digging in to DGNs

AutoCAD Map 3D includes some additional tools for importing DGN (as well as other file formats) information into AutoCAD. There is a command called MAPIMPORT (you can reach it from the Map menu in the 2009 and earlier products, or from the Map Workspaces in 2010 – or just type MAPIMPORT). It allows you to import all or part of a DGN file. You will have the option to select the levels you want to import, as well as any attribute information. Furthermore, if you are commonly doing the same type of import, you can save the settings for future use. In your case, with a very large file, you may want to import the DGN in smaller parts by selecting groups of levels in the Input Layer section.

 The process works like this – start the MAPIMPORT command. You will get this dialog box:

Mapimport1

 The top section allows you to manage any coordinate information. This is a way to project the source drawing objects into a new coordinate system.

 The Spatial Filter allows you to import drawing objects by selecting an area.

 The Saved Profiles section will allow you to modify how AutoCAD will recognize the source drawing objects, such as how to manage cells:

Mapimport2

 On the initial dialog box, the Input Layer provides a list of the levels present in the DGN file. You can select any or all of the levels you want to import. For large files you want to split up, this is a great way to do that. For Geospatial users building datasets, this is a method to break up the data by thematic groups.

Mapimport3

The Drawing layer is the target AutoCAD layer. You can leave it as the Input Layer, select a layer from the drawing, create a new layer, or create a layer based on one of objects’ data fields from the DGN. Just select the ellipsis (…) at the right (click in the layer box to show it).

Mapimport4

If you are using Map’s Object Classification tools, you can convert imported objects into classes.

You can also convert the DGN’s data fields into AutoCAD Map Object Data as well, even going so far as to map the specific elements to specific Object Data fields.

Mapimport5

At the right of the import properties, you also have some control of how certain insert objects are imported. You can use AutoCAD Points, text (with the value taken from a data field), blocks, and even get attribute values from the data fields.

You can also save this profile you’ve created, so that you can reuse it with other DGNs from the same organization (provided they use consistent standards).

 You can learn all about the tool by starting the command, and clicking the help button on the dialog box. That will take you right to that section of the helps which will explain the tool.

Try it out – it’s a powerful way to work with outside data sources. Try it with files other than DGNs as well. It could save you some time.

WordPress Themes