FME Version
Files
-
- 200 KB
- Download
Introduction
Translating from CAD to GIS enables the CAD drawings to become enhanced with spatial information and attributes. The data in a CAD file requires manipulation to extract valuable information, such as geometries and labels, to fit the data structure of GIS data. This article provides an overview of some common tasks involved in a CAD to GIS transformation.
In the example workspace, the following tasks are performed to translate from a MicroStation DGN file to an Esri File Geodatabase:
- Transfer attributes by overlaying text features onto polygons representing districts from the DGN file, and write to a new polygon Esri Geodatabase feature class,"District"
- Create polygons from lines representing parcels in the DGN file, overlay parcel text features with the parcel polygons, and write to a new polygon feature class, "Parcel"
- Take a text feature representing parcel line length, and use a nearest neighbor operation to transfer the length to an attribute of the "ParcelLine" Esri Geodatabase feature class
Step-by-Step Instructions
Part 1: Read Microstation DGN Data
1. Add a Bentley MicroStation V8 Reader
Start FME Workbench. On the Start Page, select New Workspace to create a blank canvas.
Add a Reader to the workspace (from the Readers menu, select Add Reader).
Set the Format to Bentley MicroStation V8 and set the Dataset to read the NorthVancouver.dgn. Set the Coordinate System to UTM83-10.
Open the Parameters and set Group Elements By to Level Name, click OK
Choose all of the Feature Types except Default.
We will have to expose extra attributes so that they can be used downstream in the workspace to create the relevant parcels in the Geodatabase. Expose the Following Attributes for each feature type by double-clicking on the feature type and clicking on the Format Attributes tab and clicking the check box next to the desired attributes.
DistrictLotLBL
- igds_basename
- igds_class
- igds_color
- igds_graphic_group
- igds_style
- igds_text_string
- igds_weight
DistrictLot
- igds_class
- igds_color
- igds_graphic_group
- igds_style
- igds_weight
LotLBL
- igds_basename
- igds_class
- igds_color
- igds_graphic_group
- igds_style
- igds_text_string
- igds_weight
ParcelBoundary
- igds_class
- igds_color
- igds_graphic_group
- igds_style
- igds_weight
ParcelLineLength
- igds_basename
- igds_class
- igds_color
- igds_graphic_group
- igds_style
- igds_text_string
- igds_weight
Part 2: Create Polygons and Transfer Attributes from Text to Polygons
Part 2a: Transfer Attributes from Text to Polygons
1. Rename Attributes
Add an AttributeRenamer transformer to the canvas. Connect the DistrictLotLBL to the AttributeRenamer. Rename the following Attributes:
igds_text_string as Input and BlocID as Output
igds_basename as Input and District as Output
2. Overlay Polygons with BlockID and District Attributes
Add a PointOnAreaOverlayer transformer to the canvas. Connect the AttributeRenamer to the Point input port and the DistrictLot Feature type to the Area input port. Expand the Attribute Accumulation section and tick the Merge Attributes box.
3. Add File Geodatabase Writer
Add Esri Geodatabase (File Geodb Open API) Writer, select an output folder to write the .gdb to. Name the Feature Class as District select geodb_polygon as the Geometry.
Part 2b: Parcels - Create Polygons and transfer attributes.
1. Build Polygons
Add an AreaBuilder transformer to the canvas. Connect the ParcelBoundary feature type to the AreaBuilder. Expand the Snapping Pre-Processing Parameters, set the Snapping Type to End Point Snapping, and Snapping Tolerance to 0.2. Expand Attribute Accumulation and set Accumulation Mode to Drop Incoming Attributes.
2. Rename Attributes
Add another AttributeRenamer transformer to the canvas. Connect the LotLBL feature type to the AttributeRenamer_2. Set the following attributes to be renamed.
Igds_text_string as Input and LotID as Output
Igds_basename as Input and District as Output
3. Overlay Polygons with BlockID and District Attributes
Add another PoinOnAreaOverlayer transformer to the canvas. Connect the AttributeRenamer to the Point input port and the AreaBuilder Area output port to the Area input port on the PointOnAreaOverlayer. Expand the Merge Attributes dialog choose Accumulation Mode as Merge Incoming and Conflict Resolution to Use Original.
4. Add DGN Feature Type
Right-click on the canvas and select Insert Writer Feature Type. Name the Feature Class as Parcel and set the Geometry geodb_polygon.
Part 3: Transfer Text Values Onto Lines
Part 3a: Separate Single Text Features from Multi Text Features
1. Rename Attributes
Add a third AttributeRenamer transformer to the canvas. Connect the ParcelLineLength reader to the AttributeRenamer_3. Rename the following Attributes as per the screenshot below.
igds_text_string as Input and Length as Output
igds_basename as Input and District as Output
2. Filter Geometry
Next, add a GeometryFilter to the canvas and connect the AttributeRenamer_3 to the GeometryFilter. Open the GeometryFilter parameters and set Geometry Types to Filter to Text.
3. Calculate the length of the Text
Add a StringLengthCalculator to the canvas. Connect the Text output port from the GeometryFilter to the StringLengthCalculator. Open the StringLengthCalculator parameters, set the Source Attribute to Length and set the String Length Attribute to _stringlength.
4. Filter the Text by Length
Add a Tester transformer to the canvas and connect the StringLengthCalculator to the Tester transformer. Open the Tester parameters and set up the following Test Clause:
_stringlength = 1
If _stringlength = 1, this means there are individual pieces of text which need to be combined into one in Step 3b - otherwise the text is a complete piece and passed to Step 3c.
Part 3b: Combine Multiple Text Features into one
1. Extract Coordinates
Add a CoordinateExtractor transformer to the canvas, connect the Passed output port from the Tester transformer in 3a to the CoordinateExtractor transformer. Set the transformer to specify coordinates and set the default z value to -9999
2. Convert Text to Polygons
Next, add a Bufferer transformer to the canvas. Connect the CoordinateExtractor transformer output port to the Bufferer transformer. Open the Bufferer parameters and set the following parameters. Changes the ParcelLineLength geometry from text to polygon. Text is preserved as the Length attribute. End Cap Style & Corner Style: Round Interpolation Angle: 1.
3. Merge Overlapping Polygons
Add a Dissolver transformer to the canvas. Connect the Buffered output port from the Bufferer to the Dissolver. Open the Dissolver parameters. Set the Tolerance to None. Connect Z Mode to First Wins, Aggregate Handling to Deaggregate. Attribute Accumulation to Drop incoming Attributes, Attributes to Average fme_rotation and fem_text_size. Click the Generate List option and type List as the list name.
The Dissolver merges overlapping polygons by removing shared boundaries. Length attribute values are preserved by storing them in lists.
4. Sort List
Add a ListSorter transformer to the canvas. Connect the Dissolver Area output port to the ListSorter. In the ListSorter, set the List Attribute to List{}._x, then leave the Sort Type and Sort Order as the default.
5. Index List
Add a ListIndexer transformer to the canvas. Connect the Output port of the ListSorter to the ListIndexer. Set List Attributes to the List{} and set List Index To Copy as 0.
6. Populate Length Attribute
Add a ListConcatenator transformer to the canvas. Connect the Output port of the ListIndexer to the ListConcatenator. The ListConcatenator concatenates the lists' Length values, then populates the main Length attribute with the concatenated result. Set List Attributes to List{}.Length then set Destination Attribute as Length.
7. Create Points
Add a VertexCreator transformer to the canvas. Connect the ListConcatenator Output port to the VertexCreator. Set the Mode to Replace with Point and set the X and Y values to read _x and _y respectively. The VertexCreator will serve as the insertion point for the Length value.
8. Set Text Properties
Add a TextPropertySetter transformer to the canvas, this transformer will change the geometry back to Text. Connect the VertexCreator Output port to the TextPropertySetter. Open the TextPropertySetter parameters set the following parameters, Text String: Length, Text Size: fme_text_size, Text Rotation: fme_rotation.
Part 3c: Transfer Text Values onto Parcel Lines
1. Create Bounding Box for ParcelLineLength
Add a BoundingBoxReplacer transformer to the canvas. Connect the TextPropertySetter to the BoundingBoxReplacer. This transformer replaces all ParcelLineLength features with a bounding box so that it is easier to match the correct parcel length with the parcel lines.
2. FIlter Line and Arc Geometry
Add a GeometryFilter transformer to the canvas. Connect the ParcelBoundary feature type to the GeometryFilter transformer. In the GeometryFilter parameters set the Geometry Types to Filter to read Lines and Arcs.
3. Match ParcelBoundary Lines and Arcs with
Add a NeighborFinder transformer to the canvas. Connect the Line and Arc output ports from the GeometryFIlter to the Base input port of the NeighborFinder. Then connect the Box output port from the BoundingBoxReplacer transformer to the Candidate input port on the NeighborFinder. The NeighborFinder matches ParcelBoundary lines and arcs with the ParcelLineLength text features. ParcelBoundary lines and arcs which have matches will obtain Length and District attributes from ParcelLineLength.
4. Calculate Length of Lines and Arcs
Add a LengthCalculator transformer to the canvas. Connect the Matched output port from the NeighborFinder transformer to the LengthCalculator. Change the Length Attribute to _calculatedLength.
5. Calculate Length of Lines and Arcs
Add a Tester transformer to the canvas. Connect the Output port from the LengthCalculator to the Tester transformer. Set up the following Test Clause.
|
Left Value |
Operation |
Right Value |
|
@Value(_calculatedLength)-@Value(Length) |
< |
1 |
OR |
@Value(_calculatedLength)-@Value(Length) |
< |
-1 |
6. Remove Length Attribute
Add an AttributeRemover transformer to the canvas. Connect the Failed output port of the Tester to the AttributeRemover. Open the AttributeRemover transformer parameters, set the Attributes to Remove to the Length attribute.
Right-click on the canvas and select Insert Writer Feature Type. Name the Feature Class as ParcelLine and set the Geometry geodb_polyline. Once this is complete connect the Passed output port from the Tester transformer and the Output port from the AttributeRemover transformer to the ParcelLine writer feature type.
Results
3 feature classes in a Geodatabase:
- Polygon Feature Class: “District”
- Polygon Feature Class: “Parcel”
- Line Feature Class: “ParcelLine”
Output Esri File Geodatabase
Data Attribution
The data used here originates from open data made available by the District of North Vancouver. It contains information licensed under the Open Government License - North Vancouver.
Comments
0 comments
Please sign in to leave a comment.