Module: CocinaDisplay::Geospatial::DMSParser::Helpers
- Defined in:
- lib/cocina_display/geospatial.rb
Instance Method Summary collapse
-
#normalize_coord(coord_str) ⇒ String
Standardize coordinate format so Geo::Coord can parse it.
Instance Method Details
#normalize_coord(coord_str) ⇒ String
Standardize coordinate format so Geo::Coord can parse it.
259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/cocina_display/geospatial.rb', line 259 def normalize_coord(coord_str) matches = coord_str.match(self::POINT_PATTERN) return unless matches hem = matches[:hem] deg = matches[:deg].to_i min = matches[:min].to_i sec = matches[:sec].to_i "#{deg}°#{min}′#{sec}″#{hem}" end |