Class: BlacklightHeatmaps::GeometryParser
- Inherits:
-
Object
- Object
- BlacklightHeatmaps::GeometryParser
- Defined in:
- app/models/concerns/blacklight_heatmaps/geometry_parser.rb
Overview
Parser that tries to understand the type of geospatial data stored in a String and sends that to the correct parsing class.
Class Method Summary collapse
-
.parse(geometry) ⇒ Object
Utility method for determing the type of spatial data stored in a string field.
Class Method Details
.parse(geometry) ⇒ Object
Utility method for determing the type of spatial data stored in a string field
10 11 12 13 14 15 16 17 18 19 |
# File 'app/models/concerns/blacklight_heatmaps/geometry_parser.rb', line 10 def self.parse(geometry) case geometry when /^ENVELOPE\(.*\)$/ BlacklightHeatmaps::BoundingBox.from_envelope(geometry) when /^(\-?\d+(\.\d+)?) \w*(\-?\d+(\.\d+)?)$/ BlacklightHeatmaps::Point.from_lng_lat(geometry) else raise BlacklightHeatmaps::Exceptions::UnknownSpatialDataType end end |