Class: BlacklightMaps::Geometry::Point
- Inherits:
-
Object
- Object
- BlacklightMaps::Geometry::Point
- Defined in:
- lib/blacklight/maps/geometry.rb
Overview
This class contains Point objects and methods for working with them
Class Method Summary collapse
-
.from_lat_lon_string(points) ⇒ Object
Creates a new point from from a coordinate string “-50,100” (lat,long).
Instance Method Summary collapse
-
#initialize(points) ⇒ Point
constructor
points is an array corresponding to the longitude and latitude values [long, lat].
-
#normalize_for_search ⇒ Object
returns a string that can be used as the value of solr_parameters normalizes any long values >180 or <-180.
Constructor Details
#initialize(points) ⇒ Point
points is an array corresponding to the longitude and latitude values
- long, lat
62 63 64 65 |
# File 'lib/blacklight/maps/geometry.rb', line 62 def initialize(points) @long = points[0].to_f @lat = points[1].to_f end |
Class Method Details
.from_lat_lon_string(points) ⇒ Object
Creates a new point from from a coordinate string “-50,100” (lat,long)
77 78 79 |
# File 'lib/blacklight/maps/geometry.rb', line 77 def self.from_lat_lon_string(points) new(points.split(',').reverse) end |
Instance Method Details
#normalize_for_search ⇒ Object
returns a string that can be used as the value of solr_parameters normalizes any long values >180 or <-180
69 70 71 72 73 |
# File 'lib/blacklight/maps/geometry.rb', line 69 def normalize_for_search @long -= 360 if @long > 180 @long += 360 if @long < -180 [@long, @lat] end |