Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a4d7908

Browse files
committed
Reverse coordinate order for Yandex.
On input and output (expects/returns lon,lat instead of lat,lon).
1 parent 1bd5a78 commit a4d7908

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

lib/geocoder/lookups/yandex.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def results(query, reverse = false)
1818
end
1919

2020
def query_url(query, reverse = false)
21+
query = query.split(",").reverse.join(",") if reverse
2122
params = {
2223
:geocode => query,
2324
:format => "json",

lib/geocoder/results/yandex.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Geocoder::Result
44
class Yandex < Base
55

66
def coordinates
7-
@data['GeoObject']['Point']['pos'].split(' ').map(&:to_f)
7+
@data['GeoObject']['Point']['pos'].split(' ').reverse.map(&:to_f)
88
end
99

1010
def address(format = :full)

0 commit comments

Comments
 (0)