+
+ if place.attributes["rank"].to_i <= 30
+ parent = nil
+ parentrank = 0
+ parentdistance = 0
+
+ place.elements.each("nearestplaces/named") do |nearest|
+ nearestrank = nearest.attributes["rank"].to_i
+ nearestdistance = nearest.attributes["distance"].to_f
+
+ if nearestrank > parentrank or
+ ( nearestrank == parentrank and nearestdistance < parentdistance )
+ parent = nearest
+ parentrank = nearestrank
+ parentdistance = nearestdistance
+ end
+ end
+
+ if parent
+ parentname = format_name(parent.attributes["name"].to_s)
+
+ if place.attributes["info"].to_s == "suburb"
+ suffix = "#{suffix}, #{parentname}"
+ else
+ suffix = "#{suffix} (near #{parentname})"
+ end
+ end
+ end