Class: BlacklightHeatmaps::Point
- Inherits:
-
Object
- Object
- BlacklightHeatmaps::Point
- Defined in:
- app/models/concerns/blacklight_heatmaps/point.rb
Overview
A geometry class to characterize points. Can be longitude and latitude.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(x, y) ⇒ Point
constructor
A new instance of Point.
-
#to_geojson ⇒ Object
String.
Constructor Details
#initialize(x, y) ⇒ Point
Returns a new instance of Point.
5 6 7 8 |
# File 'app/models/concerns/blacklight_heatmaps/point.rb', line 5 def initialize(x, y) @x = x.to_f @y = y.to_f end |
Class Method Details
.from_lng_lat(lng_lat) ⇒ Object
23 24 25 |
# File 'app/models/concerns/blacklight_heatmaps/point.rb', line 23 def self.from_lng_lat(lng_lat) new(*lng_lat.split(' ')) end |
Instance Method Details
#to_geojson ⇒ Object
Returns String.
12 13 14 15 16 17 18 19 |
# File 'app/models/concerns/blacklight_heatmaps/point.rb', line 12 def to_geojson { type: 'Point', coordinates: [ x, y ] }.to_json end |