From: Tom Hughes Date: Sun, 14 Jul 2024 14:40:39 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/pull/4984' X-Git-Tag: live~376 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/185972855834ecba5eb064582a03d6cd979cde9f?ds=inline;hp=--cc Merge remote-tracking branch 'upstream/pull/4984' --- 185972855834ecba5eb064582a03d6cd979cde9f diff --cc app/controllers/geocoder_controller.rb index ca6bab6df,02ebc8a1b..43f276efa --- a/app/controllers/geocoder_controller.rb +++ b/app/controllers/geocoder_controller.rb @@@ -224,8 -220,16 +220,16 @@@ class GeocoderController < ApplicationC params.permit(:query, :lat, :lon, :latlon_digits, :zoom, :minlat, :minlon, :maxlat, :maxlon) end + def dms_regexp(name_prefix) + / + (?: (?<#{name_prefix}d>\d{1,3}(?:\.\d+)?)°? ) | + (?: (?<#{name_prefix}d>\d{1,3})°?\s*(?<#{name_prefix}m>\d{1,2}(?:\.\d+)?)['′]? ) | + (?: (?<#{name_prefix}d>\d{1,3})°?\s*(?<#{name_prefix}m>\d{1,2})['′]?\s*(?<#{name_prefix}s>\d{1,2}(?:\.\d+)?)["″]? ) + /x + end + def to_decdeg(captures) - ns = captures.fetch("ns").casecmp("s").zero? ? -1 : 1 + ns = captures.fetch("ns").casecmp?("s") ? -1 : 1 nsd = BigDecimal(captures.fetch("nsd", "0")) nsm = BigDecimal(captures.fetch("nsm", "0")) nss = BigDecimal(captures.fetch("nss", "0"))