FME How To: Rotating labels

Rendering text labels based on attribute values stored in the dataset.

I have a dataset containing point features. The associated attributes include TEXT_STRING, TEXT_ANGLE and TEXT_HEIGHT. This allows me to write the label using the TEXT_STRING field, rotate it according to the TEXT_ANGLE field, and give it the correct size by using the TEXT_HEIGHT field.

However, finding an application that would let you do this proved to be harder than you might think. ArcGIS allows you to set the TEXT_STRING and TEXT_ANGLE automatically but the TEXT_SIZE has to be set individually. This is not an option when you have 30,000 labels to size.

Enter FME (www.safe.com) and some transformers to manipulate your data. My raw data is passed through a TESTER to make sure all the features have a valid ID, the fields are trimmed of any excess white spaces and two counters are added to create unique sequential IDs. Then the data is passed to a LABELPOINTREPLACER which replaces the point with a label (based on TEXT_STRING) and scales it using TEXT_HEIGHT. The coordinates of the points are extracted using a COORDINATEEXTRACTOR and the resulting XY values are passed to a ROTATOR which rotates the labels based on the TEXT_ANGLE field around the XY coordinate.

I like it when a workbench comes together.
FME Workbench

Leave a Reply

Your email address will not be published. Required fields are marked *