<p></p>
<p><b>@AntonKhorev</b> requested changes on this pull request.</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4961#discussion_r1674092874">app/controllers/geocoder_controller.rb</a>:</p>
<pre style='color:#555'>>
- def dms_to_decdeg(captures)
- begin
- Float(captures[0])
- lat = captures[4].casecmp("s").zero? ? -(captures[0].to_f + ((captures[1].to_f + (captures[2].to_f / 60)) / 60)) : captures[0].to_f + ((captures[1].to_f + (captures[2].to_f / 60)) / 60)
- lon = captures[9].casecmp("w").zero? ? -(captures[5].to_f + ((captures[6].to_f + (captures[7].to_f / 60)) / 60)) : captures[5].to_f + ((captures[6].to_f + (captures[7].to_f / 60)) / 60)
- rescue StandardError
- lat = captures[0].casecmp("s").zero? ? -(captures[1].to_f + ((captures[2].to_f + (captures[3].to_f / 60)) / 60)) : captures[1].to_f + ((captures[2].to_f + (captures[3].to_f / 60)) / 60)
- lon = captures[5].casecmp("w").zero? ? -(captures[6].to_f + ((captures[7].to_f + (captures[8].to_f / 60)) / 60)) : captures[6].to_f + ((captures[7].to_f + (captures[8].to_f / 60)) / 60)
- end
- { :lat => lat, :lon => lon }
+ lat = ns * (nsd + (nsm / 60) + (nss / 3600))
+ lon = ew * (ewd + (ewm / 60) + (ews / 3600))
+
+ { :lat => lat.to_s("F"), :lon => lon.to_s("F") }
</pre>
<p dir="auto">Need to <code class="notranslate">.truncate()</code> to some reasonable precision before <code class="notranslate">.to_s</code> or else the length blows up:</p>
<p dir="auto"><a href="https://github.com/openstreetmap/openstreetmap-website/assets/4158490/38852968-1c8f-4d02-bda7-0fd871a02eef">image.png (view on web)</a></p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4961#pullrequestreview-2172031821">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLNSUCPVRWGRQALGTPTZL2HP5AVCNFSM6AAAAABKPMSZMCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDCNZSGAZTCOBSGE">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLL3CI7V4KR5C5JLG43ZL2HP5A5CNFSM6AAAAABKPMSZMCWGG33NNVSW45C7OR4XAZNRKB2WY3CSMVYXKZLTORJGK5TJMV32UY3PNVWWK3TUL5UWJTUBO2JU2.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/4961/review/2172031821</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/4961#pullrequestreview-2172031821",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/4961#pullrequestreview-2172031821",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>