We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9164854 commit 36698f7Copy full SHA for 36698f7
1 file changed
app/models/sample_set.rb
@@ -193,6 +193,7 @@ def nice_key(raw_key)
193
end
194
195
def parse_location_coordinate(string, type)
196
+ type = type.to_s.downcase.to_sym
197
# A simple (positive) number, no captures
198
num = /[\d\.,]+/
199
# A sexagesimal coordinate (without direction), captures:
@@ -218,6 +219,11 @@ def parse_location_coordinate(string, type)
218
219
m[1].gsub(',', '.').to_f
220
221
222
+ if decimal.abs > 180.0 || (type == :lat && decimal.abs > 90.0)
223
+ warn 'unexpectedly large value for %s: %.2f' % [type, decimal]
224
+ return nil
225
+ end
226
+
227
allowed_dir = { lat: %w[S s N n], lon: %w[W w E e] }
228
if m[2].present? && !allowed_dir[type.to_sym].include?(m[2])
229
warn 'unexpected direction for %s: %s' % [type, m[2]]
0 commit comments