Correct calculation of reciprocal angles.
authorTom Hughes <tom@compton.nu>
Sat, 25 Aug 2007 22:33:46 +0000 (22:33 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 25 Aug 2007 22:33:46 +0000 (22:33 +0000)
app/controllers/geocoder_controller.rb

index 4ed94b6498be7aa70e9ffa47b1d6218b9f83dae1..8abcbdc4445a773acaad8bfe2506e90e16b609ba 100644 (file)
@@ -185,7 +185,7 @@ private
       name = named.attributes["name"].to_s
       description = named.elements["description"].to_s
       distance = format_distance(place.attributes["approxdistance"].to_i)
       name = named.attributes["name"].to_s
       description = named.elements["description"].to_s
       distance = format_distance(place.attributes["approxdistance"].to_i)
-      direction = format_direction(360 - place.attributes["direction"].to_i)
+      direction = format_direction((place.attributes["direction"].to_i - 180) % 360)
       prefix = "#{distance} #{direction} of #{type} "
       results.push({:lat => lat, :lon => lon, :zoom => zoom,
                     :prefix => prefix.capitalize, :name => name,
       prefix = "#{distance} #{direction} of #{type} "
       results.push({:lat => lat, :lon => lon, :zoom => zoom,
                     :prefix => prefix.capitalize, :name => name,