module Geocoder::Calculations
def extract_coordinates(point)
running method and may return nil.
[lat,lon] array. Note that if a string is passed this may be a slow-
or an object that implements +to_coordinates+ and returns a
Takes an object which is a [lat,lon] array, a geocodable string,
#
def extract_coordinates(point) case point when Array if point.size == 2 lat, lon = point if !lat.nil? && lat.respond_to?(:to_f) and !lon.nil? && lon.respond_to?(:to_f) then return [ lat.to_f, lon.to_f ] end end when String point = Geocoder.coordinates(point) and return point else if point.respond_to?(:to_coordinates) if Array === array = point.to_coordinates return extract_coordinates(array) end end end [ NAN, NAN ] end