lib/geocoder/results/yandex.rb in geocoder-1.3.0 vs lib/geocoder/results/yandex.rb in geocoder-1.3.1
- old
+ new
@@ -66,9 +66,16 @@
def precision
@data['GeoObject']['metaDataProperty']['GeocoderMetaData']['precision']
end
+ def viewport
+ envelope = @data['GeoObject']['boundedBy']['Envelope'] || fail
+ east, north = envelope['upperCorner'].split(' ').map(&:to_f)
+ west, south = envelope['lowerCorner'].split(' ').map(&:to_f)
+ [south, west, north, east]
+ end
+
private # ----------------------------------------------------------------
def address_details
@data['GeoObject']['metaDataProperty']['GeocoderMetaData']['AddressDetails']['Country']
end