Serialize location tree as a tree.