Module: NDFD::Client::QueryUtilities

Instance Method Summary collapse

Instance Method Details

#build_coordinates(coordinates) ⇒ Object


4
5
6
# File 'lib/ndfd/client/query/query_utilities.rb', line 4

def build_coordinates(coordinates)
  coordinates.map { |hsh| "#{hsh[:latitude]},#{hsh[:longitude]}" }.join(" ")
end

#transform_coordinate_list(document) ⇒ Object


8
9
10
11
12
13
# File 'lib/ndfd/client/query/query_utilities.rb', line 8

def transform_coordinate_list(document)
  document.xpath("//latLonList").text.split.map do |coord|
    latitude, longitude = coord.split(",").map(&:to_f)
    { :latitude => latitude, :longitude => longitude }
  end
end