Introduction
LandXML is an XML-based survey exchange format. In FME, these files can be read and written using the LandXML Reader/Writer, which supports a subset of all of the available element types in this data format.
The attached workspace demonstrates how to create valid LandXML files containing various element types. To test the validity of the LandXML file produced, it can be submitted to the official LandXML Data Validator, which will validate the file and produce a PDF report.
Step-by-Step Instructions
A valid LandXML file must include at least a RootProperties element and a Units element. Other elements can be added to define the data, such as establishing the coordinate system using the CoordinateSystem element.
In FME, the element type in the output LandXML file comes from the Feature Type name or the landxml_landxml_type attribute. For example, if you set the Feature Type name or the landxml_landxml_type attribute to Parcel, the element type will be Parcel.
The below steps outline how to create a valid LandXML file that contains various elements.
1. Open the start template in FME Workbench
Open the attached workspace template called “Write_LandXML_Start.fmwt” in FME Workbench. The workspace is configured to read a Shapefile dataset using a Shapefile reader and prepare it using transformers.
2. Add a LandXML writer
The best way to write to LandXML is to import the feature types from an existing LandXML dataset. The feature types and attributes will already be configured, saving you time and effort. If you don't have one already, you can download a sample from the LandXML.org Sample Files webpage. In this tutorial, we will use the attached sample dataset called SampleData.xml.
2(a). Click "Add Writer". Set the destination format to LandXML and an output path. For the Feature Type Definition, choose "Import from Dataset".
Click OK.
2(b). In the Import Writer Feature Types dialog, select the file you downloaded from the tutorial attachments, SampleData.xml.
Click OK.
2(c). In the Select Feature Types dialog, we can choose the feature types to import. For now, select only RootProperties.
Click OK.
You have successfully added a LandXML writer with one feature type or element type to the workspace. Note the Shapefile reader and LandXML writer in the workspace’s Navigator pane.
3. Connect the RootProperties writer feature type
RootProperties is a mandatory element that must be in the output LandXML file. This includes basic properties like Date, Time, and Version. This workspace has RootProperties data pre-configured in the AttributeCreator and TimeStamper transformers. Open those transformers' parameters to see how the attributes are configured.
In the previous step, we added a RootProperties feature type when we added the LandXML writer to the workspace. Connect the AttributeCreator to the RootProperties feature type. Expand the feature type to see the attributes.
You have successfully added a RootProperties element to the output LandXML dataset, which has the attributes Date, Language, Time, Version, and readOnly.
4. Add a Units writer feature type
Units is the second mandatory element that must be in the output LandXML file. This includes the units used in the dataset for attributes like Angular, Area, and Linear. In this workspace, the units have been defined in the transformer AttributeCreator_2. Open its parameters to see how the attributes are configured.
4(a). Click the “Writers” menu and choose “Import Feature Types”. Again, set the path to SampleData.xml. In the Select Feature Types dialog, choose "Units".
Click OK.
4(b). Connect the AttributeCreator_2 to the Units feature type. Expand the feature type to see the attributes.
Now you have successfully added a Units element in the output LandXML dataset, which has the attributes AngularUnit, AreaUnit, and others defined in the workspace.
5. Add an “Application” writer feature type
Now we will add a feature type that is not mandatory, but that we would like to see in the output LandXML data. This feature type will contain information about the application used to create the data. The workspace has pre-populated the attributes in the second bookmark in the workspace template.
Using the same steps as above, import the Application feature type. Connect it to TimeStamper_3.
Now you have successfully added an Application element to the output LandXML dataset, which has the attributes Name, Desc, Manufacturer, and other information that was populated manually in the workspace.
6. Add a feature type with a Name attribute
In some cases, such as when importing data to Autodesk Civil 3d, the LandXML features must have names. To create a feature name, add an attribute called Name and populate it with the feature name.
6(a). Add a new AttributeCreator transformer, and add it into the next bookmark. Connect it after Creator_2.
6(b). Open the parameters of the AttributeCreator you just added. Add one attribute:
- New Attribute: Name
- Attribute Value: Project Name
Click OK.
6(c). Import the Project feature type from SampleData.xml and connect it after the AttributeCreator.
You have successfully added a Name attribute to the current element type, “Project”.
6. Add other feature types as needed
See the rest of the workspace for more examples of adding elements to the output file. Usage notes for various element types are included in the section below. Note how attributes can be renamed to comply with the LandXML schema.
Open "Write_LandXML_Complete.fmwt" to see the completed workspace. You can run the workspace and try the LandXML Data Validator with the output dataset.
Notes on Creating Specific LandXML Element Types
Alignment
- No parent references are required. FME will create them for you.
- Accepts linear geometry - Paths or Lines.
- Length, Name, and StaStart attributes must be present to be valid.
- Attribute landxml_landxml_type must be set to Alignment.
- Root geometry must have trait landxml_geometry_type set to ‘alignment_boundary’.
PlanFeature
- No parent references are required. FME will create them for you.
- Accepts Point or Linear geometry.
- Name attribute is not required, but recommended to store the feature type name.
Surface
- No parent references required. FME will create them for you.
- Accepts Surface, Multisurface, or Mesh geometry.
- Name attribute is required to validate.
Parcel
- No parent references required. FME will create them for you.
- Accepts Polygon geometry.
- Name and Area attributes are required to validate.
CgPoint
- No parent references required. FME will create them for you.
- Name and Code attributes are required to validate.
PipeNetworks, Pipes, and Structs
- Pipe networks contain two types of child collections: Pipes and Structures, each of which contains its own child Pipe and Structure features.
- Parent-child relationships must be explicitly set.
- A Pipe must reference its parent Pipes collection, which in turn references its parent PipeNetwork feature. A Structure must reference its parent Structures collection, which in turn references its parent PipeNetwork. These references are set using the landxml_element_id and landxml_parent_id format attributes, for the children to reference their parents.
- Note that LandXML Pipe Networks can only be created in FME 2022.1 or higher.
Data Attribution
The data used here is derived from data made available by the LandXML.org Sample Files webpage. It contains information made openly available by LandXML.org.
Comments
0 comments
Please sign in to leave a comment.