Skip to content

Commit

Permalink
Minor formatting, adding a couple of examples for Dmitry.
Browse files Browse the repository at this point in the history
  • Loading branch information
TuckerJD committed Dec 1, 2014
1 parent 89f993d commit 570ca21
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/utilities/geo.rb
Expand Up @@ -42,8 +42,8 @@ def self.degrees_minutes_seconds_to_decimal_degrees(dms_in)
/(?<degrees>-*\d+):(?<minutes>\d+\.*\d*)(:(?<seconds>\d+\.*\d*))*/ =~ dms
end
# >40°26′46″< >40°26′46″<
if dms.include?('D') or dms.include?('º') or dms.include?('°')
/(?<degrees>-*\d+)[º°D]\s*(?<minutes>\d+\.*\d*)['′]*\s*((?<seconds>\d+\.*\d*)["″])*/ =~ dms
if dms.include?('D') or dms.include?('º') or dms.include?('°') or dms.include?('∞')
/(?<degrees>-*\d+)[º°D]\s*(?<minutes>\d+\.*\d*)['′]*\s*((?<seconds>\d+\.*\d*)["″])*/ =~ dms
end

degrees = degrees.to_f
Expand Down
6 changes: 3 additions & 3 deletions spec/models/collecting_event_spec.rb
Expand Up @@ -268,9 +268,9 @@
generate_political_areas_with_collecting_events
}
after(:all) {
Georeference.destroy_all
GeographicItem.destroy_all
CollectingEvent.destroy_all
# Georeference.destroy_all
# GeographicItem.destroy_all
# CollectingEvent.destroy_all
clean_slate_geo
}

Expand Down
8 changes: 5 additions & 3 deletions spec/support/geo/geo.rb
Expand Up @@ -5,8 +5,8 @@

# http://en.wikiversity.org/wiki/Geographic_coordinate_conversion

LATLONG_USE_CASES = {'40º26\'46"N' => '40.446111', # using MAC-native symbols

This comment has been minimized.

Copy link
@mjy

mjy Dec 2, 2014

Member

@TuckerJD nice use of a hash to manage this style of testing.

This comment has been minimized.

Copy link
@TuckerJD

TuckerJD Dec 2, 2014

Author Contributor

@proceps @mjy Big help from Dmitry on regex and examples!

'079º58\'56"W' => '-79.982222', # using MAC-native symbols
LATLONG_USE_CASES = {'40º26\'46"N' => '40.446111', # using MAC-native symbols
'079º58\'56"W' => '-79.982222', # using MAC-native symbols
'40:26:46.302N' => '40.446195',
'079:58:55.903W' => '-79.982195',
'40°26′46″N' => '40.446111',
Expand All @@ -28,7 +28,9 @@
'N40d 26′ 46″' => '40.446111',
'W079d 58′ 56″' => '-79.982222',
'N40.446195' => '40.446195',
'W79.982195' => '-79.982195'}
'W79.982195' => '-79.982195',
'42∞5\'18.1"S' => '-42.088361',
'w88∞11\'43.3"' => '-88.195361'}

#FFI_FACTORY = ::RGeo::Geos.factory(native_interface: :ffi, srid: 4326, has_m_coordinate: false, has_z_coordinate: true)

Expand Down

0 comments on commit 570ca21

Please sign in to comment.