module Geocoder::Calculations

def bounding_box(point, radius, options = {})

Experimental RBS support (using type sampling data from the type_fusion project).

def bounding_box: (Array[Float] point, Float radius, ?Hash options) -> untyped

This signature was generated using 1 sample from 1 application.


Use Geocoder.configure(:units => ...) to configure default units.
* :units - :mi or :km.

ways of specifying the point. Also accepts an options hash:
See Geocoder::Calculations.distance_between for

(ActiveRecord queries use it thusly).
roughly limiting the possible solutions in a geo-spatial search
This is useful for finding corner points of a map viewport, or for

is twice the radius).
from the center point to any side of the box (the length of each side
with the given point at its center. The radius is the shortest distance
Returns coordinates of the southwest and northeast corners of a box
#
def bounding_box(point, radius, options = {})
  lat,lon = extract_coordinates(point)
  radius  = radius.to_f
  [
    lat - (radius / latitude_degree_distance(options[:units])),
    lon - (radius / longitude_degree_distance(lat, options[:units])),
    lat + (radius / latitude_degree_distance(options[:units])),
    lon + (radius / longitude_degree_distance(lat, options[:units]))
  ]
end