FME Version
Files
Introduction
Measuring areas is very simple in FME and requires just the use of the AreaCalculator transformer. Here, for example, a user is measuring the area of park features:
The area of each park feature is measured and added to the feature as an attribute called ParkArea.
Area is measured in the units of the coordinate system being used. For example, if the source data is in a coordinate system based on metres (meters) then the AreaCalculator returns values in square metres.
There are some simple variations and issues to be aware of.
Variations
- The multiplier parameter sets a value by which the result is multiplied. This is most used when converting between units; for example if the source data is in metres and the multiplier is set to 0.000247105, then the result will be in acres.
- The result is calculated to a precision not usually required for most uses. The AttributeRounder is often used after the AreaCalculator to round the results to fewer decimal places.
- A more advanced variation is to use the @Area() function inside a transformer such as the AttributeManager.
Cautions
- The attribute created by the transformer needs to be added to the destination schema if it is to be recorded in the output.
- Non-area features output via the rejected port.
- A multi-polygon or aggregate feature returns an area that is the sum of its parts.
- A donut polygon feature returns an area that excludes the area of the hole.
Video
Step-by-step Instructions
Follow these steps as an example of how to calculate the area of polygon features.
1. Start FME Workbench and generate a workspace to translate the attached source data from MapInfo TAB format (MITAB Reader) back to MapInfo TAB format. Choose a different folder for the output.
2. Add an AreaCalculator transformer between the reader and writer feature types.
3. Open the parameters dialog for the AreaCalculator transformer. Ensure the Area Attribute parameter is set to write an attribute called ParkArea.
4. Open the parameters dialog for the writer feature type. Click the Attributes tab and add a new attribute called ParkArea of type float.
5. Optionally add an AttributeRounder transformer after the AreaCalculator. Open its parameters dialog and set it up to round the ParkArea attribute to 3 decimal places.
6. Save and run the workspace. Inspect the output. Notice the new ParkArea attribute with values rounded to 3 decimal places.
Why not take this example one step further by calculating the average area of the parks? You can use a StatisticsCalculator to calculate the average of all ParkArea values.
Comments
0 comments
Please sign in to leave a comment.