Convert Surveyor Metes and Bounds into Cartesian Coordinates

by Don Colton

# example (Rosewold 2012)
South 25 55 West 418.47 feet
North 65 West 618.29 feet
North 17 45 West 149.46 feet
North 0 28 East 117.73 feet
North 24 East 150 feet
North 49 10 East 56.54 feet
South 65 East 754.80 feet

# example (Rosewold 2013-12-26)
rotate -25
South 25 West 443.83 feet
North 63 42 31 West 629.14 feet
North 17 45 West 149.46 feet
North 0 28 East 117.73 feet
North 24 East 150 feet
North 27 25 55 East 62.88 feet
South 65 East 779.27 feet

# each line must be north/south degrees east/west distance units
# the word "thence" at the start of each line is optional.
# directions: only the first letter is needed; N means North
# headings are degrees space minutes space seconds
# note: also understands things like 76.25 degrees
# note: also understands chains (66.0 feet)
# note: also understands links (0.66 feet)

# This is the regular expression pattern that must be matched on each line:
# {^(?:thence +)?(no?r?t?h?|so?u?t?h?) +(.+) +(ea?s?t?|we?s?t?),? +([^ ]+) +([a-z]+)}
# Comments are allowed. Any line starting with # is treated as a comment.
# {X ([^ ]+) Y ([^ ]+)} can be used to assign X and Y coordinates.
# {rotate (.+)} can be used to assign North to be a different angle in X-Y space.