Method: AIPP::Border.from_array
- Defined in:
- lib/aipp/border.rb
.from_array(array) ⇒ Object
New border object from array of points
The array must contain coordinate tuples in geographical order as latitude longitude separated by whitespace and/or commas.
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/aipp/border.rb', line 71 def from_array(array) geometries = array.map do |collection| collection.map do |coordinates| lat, long = coordinates.split(/[\s,]+/) AIXM.xy(lat: lat.to_f, long: long.to_f) end end allocate.instance_eval do initialize(geometries) self end end |