Extensible Markup Language (XML) is used throughout various coding and language platforms. In our field it’s used to produce and transfer data types for data prep and site construction. There are two versions of XML (1.0 and 1.1), and both will import into the current software used by civil professionals.
The basic format for XML was a good starting point for different industries. Autodesk started the widespread use of XML and import/export ability was added to more software as the code matured. Most development by commercial software vendors began to drop off after version 1.0 released in 2002. Version 1.1 is capable of additional and enhanced data but never got the desired traction.
Carlson Software of Maysville, Kentucky picked up the LandXML development process and produced version 2.0. The addition of textures and advanced data types was a good idea, but support from other platforms is lagging. I don’t think much more will happen as 2.0 was in draft as of 2014.
This image is an import of a LandXML file imported into Carlson’s Precision 3D. It includes textures, polylines and field-to-finish data such as the light poles seen along the road.
If this file were imported into another CAD program not supporting 2.0, the data would be limited to surface elements. In other words, a TIN surface with faces and breaklines would be generated without any additional data.
XML documents, in a basic discussion, are made up of markup and content. We also need to look at the header section of an XML document, as it contains information we may need.
The XML Header
Importing a file into your software is usually not a big issue. Bringing in CAD and point files is routine. An XML import should be no different. Where there could be an issue is with the XML units and how they are interpreted by the software. Let’s look at an XML header.
- We know the time and date the file was last saved
- This is a version 2.0 file. Software that only reads 1.2 will still import information, just not all.
- Know which units were used in the file. Know your software, some will not alert you of a unit mismatch. An example is provided in the corresponding video.
- We have our first look at a tag with the unit(s) callout.
Markup and Content
Markup begins with < and ends with >. Between those constraints lies the content. It also encloses tags which can have content following. Anything that is not markup is content. That rule is not absolute but for civil XML files this will be what we see for the most part.
If we drill down in this section we see a surface named All Roads and Drives. A Boundary will be created using the PntList3D points. Note the points are not comma delimited. They are Northing, Easting, and Elevation in a continous string seperated by a space.
In the next example, the screen shot calls out several boundaries and the connected points to make them. The boundaries are individual markup callouts because each 3D line encloses a different street. This will start and stop line generation for each street.
Here is a 3D view of drawn smaller boundaries. This also allows the closed line to be used in texture rendering and vertical adjustments.
In this file the surfaces that make up the roads are shown after the boundaries are written. The markup and content give you the type and ID of the TIN edge verticies as points. When the points are brought into the file, the TIN edges need to be called out so they form correctly. Shown are the end of the TIN points and the beginning of the point numbers that form the faces of the TIN.
The production of the TIN faces, (edges) continues to the end of the file.
Here are some things you will want to find out before importing an XML file. Be sure to make a copy of your file so edits can be undone if need be.
- Most critical to review are the units. U.S. and International feet can cause problems. Note that International feet will be called “foot.”
- Determine the software that produced the XML. This can come in handy. It doesn’t happen often, but files produced by different platforms don’t always import properly.
- The XML file may contain coordinate system information letting you know how the job was set up.
- Sometimes you may not want all the information provided in the file. You can clip out the tags and related elements you don’t want to import. I agree that all you need to do is delete the unwanted element. However, that unwanted element could be a huge surface or something that stops the file import and shuts down before the elements you want get put on the screen.
- The original project name is often times included as a tag. This can help you verify dates and times to confirm you are working with the latest and greatest.
Why Use XML
The ease of producing, sharing, and importing XML files has made them the format of choice for data transfer. Large scan and photogrammetry surfaces can be easily digested by smaller office computers as opposed to point cloud formats.
With this ease, many people are transferring data in this format. I have outlined some steps for users to make file sharing easier. The knowledge gained by reviewing the raw XML in a viewer cannot be over emphasized. Take some time to look at files that have worked for you in addition to those that gave you issues.
When you get to know what’s in a file by reviewing it, your confidence will increase as well as the ability to verify sources and validity of files. Work with some files and contact me with any questions or issues you have.
Update – September 2020
Recent questions have come up regarding problems with transferring data files. Here are some tips to those issues.
- Be careful what you choose to export. I have seen exports become clogged and fail because there are too many different types of data in a file.
- Old software may be limited to version 1.0 and not read 1.1
- If you have issues with a file working for you and not the recipient, try zipping the file. For some reason, mail handlers and virus programs have tainted files. This is rare but if you get frustrated, try it.
- Never drag and drop an XML file on a program screen. Use the import function. There may be settings you are missing in bypassing the command.
- No need to learn programming. But if you have a file that will not import, open it in a text viewer to see if the header looks corrupted. Compare to the examples given in this article.
- Know what type of surface you are receiving. Most surfaces are comprised of TIN lines and breaklines. If your software does not separate them on import, you can make two copies of the file and strip alternate types to import to different layers.