[GIS] Using FME to Parse An Attribute Field

fmespatial-etl

I have a table that contains a field with street names. Each street name ends with the street type. Fore example, Washington St, Happy Valley Rd, Redstone Dr. I need to extract the last part of the street name and have it populate a field called Street Type. I been trying to use the AttributeSplitter transformer but it only splits strings according to a delimiter (in this case it's a space), but this does not work. Any suggestion on using a different transformer or combination of transformers? Solutions need to be in FME as this task is part of a greater workflow.

Best Answer

Try the Regular Expressions.

It has been some time since I've used FME, but I know a while back they had a Regular Expressions Transformer (or the AttributeSplitter had a Regular Expressions option).

You should be able to use a regular expression to match some form of pattern.
For example, the address:

123 abc st, Sesame Street

could be matched by the regular expression:

"$[0-9]+\w[a-zA-Z]+([st|dr|av])[\wa-zA-Z]+"

Which indicates the pattern as,

  1. from the start of the string ($)
  2. there will be a sequence of digits : [0-9]+
  3. followed by a white space character (space, tab, etc) : \w
  4. followed by a string consisting of Upper and Lower case alpha characters: [a-zA-Z]+
  5. followed by the string of interest in the pattern: ([st|dr|av]) *NOTE
  6. followed by any number of white space and alpha characters: [\wa-zA-Z]+

NOTE The parenthesis () tag that part of the pattern to an attribute that you can use later on in your FME script.

I hope this gives you some pointers. I'll follow this question to help further if required.

Related Question