It seems to be easier to fix rather than flag unbroken intersection points between two feature layers. It took me a little while longer to flag the unbroken intersection points using FME transformers. The screenshot below shows two shape file layers - lakes (blue color fill) and rivers (red). I wanted to flag the intersecting points between the lake polygons and the river lines.
I did the following.Define the two source datasets
- Start up FME Workbench. Choose Create a blank workspace.
- Select Source Data > Add Dataset.
The Add Source Dataset dialog appears.
- In the Format field, choose ESRI Shape. In the Dataset field, click the browse [...] button.
- Select both the lake.shp and river.shp files. Click Open.
The Add Source Dataset may look like this.
- Click OK.
The Select Feature Types dialog box appears.
- Click OK.
The two selected shape files are added to the workspace.
Define the destination dataset
- Select Destination Dataset > Add Dataset.
- In the Format field, select ESRI Shape. In the Dataset field, define the output folder e.g. C:\temp\out\.
The Add Destination Dataset dialog box may look like this.
- Click OK.
The message below appears.
- Click Yes.
The Feature Type Properties dialog box appears.
- In the Feature Type Name field, type in intersect_flag. In the Allowed Geometries, choose shape_point.
The Feature Type Properties dialog box may look like this.
- Click User Attributes tab.
- Define an attribute ID with Data Type number and Width 2.
The Feature Type Properties dialog box may look like this.
Note: id will simply be a counter storing running numbers of flags.
- Click OK.
The source and destination datasets appear on the workspace.
Add in the transformers and define the flow
- Drag and drop the following transformers onto the workspace:
- Intersector
- Coordinate Fetcher (twice)
- Geometry Remover (twice)
- Aggregator
- Tester
- 2DPointAdder
- Counter
- Connect the source and destination datasets with the transformers as shown in the figure below.
- Open up the first Coordinate Fetcher transformer's properties.
Note 1: Index 0 means fetch the first coordinate.
Note 2: After the Intersector transformer has done its job, the output features are broken up at the point of intersections. The intersection points must therefore be at either ends.
- Open up the second Coordinate Fetcher transformer's properties.
- In the Index field, type in -1.
Note: -1 means fetch the last coordinate.
- Open up the Aggregator transformer's parameters.
- In the Group By field, browse and select the fields or type in the string _x _y.
- In the Count Attribute (Optional) field, type in _count.
- Open up the Tester transformer's parameters.
- Define the test _count > 2 as shown above.
- In the Pass Criteria field, choose One test must pass.
Note: At the intersection points, there must be more than two points. Anything less is either free end points or singly connected points.
- Open the 2DPointAdder transformer's parameters.
- In the X Value field, choose _x. In the Y Value field, choose _y.
- Open up the Counter transformer's parameters.
- In the Count Output Attribute field, type in id. In the Count Start field, type in 1.
Note: the Count Output Attribute field should be the same name as the destination dataset's attribute field.
- Run the translation.
The intersection points are flagged as numbered points as shown in the screen shot below.
Note that this Intersector transformer method works based on line work intersection only. If the line work sits entirely within the area polygons, there would be no line intersection and therefore no flags.
2 comments:
Hi,
Would like to say, your tutorial has been very helpful, so thank you for your effort.
I would like to ask, is there a method to identify the intersection points of only those between the two shape files, and not the intersection points of those found with just one shape file.
Thanks .
Hi pw, unfortunately the Intersector transformer doesn't differentiate between the two shape files. An alternative workbench flow would need to be worked out to do what you want.
Post a Comment