Skip to content

Commit

Permalink
Stop assuming lat and lng are in degree, minute, second
Browse files Browse the repository at this point in the history
  • Loading branch information
mo-nathan committed Dec 22, 2024
1 parent 5edcea4 commit a4fc339
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions app/javascript/controllers/geocode_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,16 +331,8 @@ export default class extends Controller {
origLng = this.lngInputTarget.value
let lat, lng

try {
let coords = convert(origLat + " " + origLng)
lat = coords.decimalLatitude,
lng = coords.decimalLongitude
}
// Toss any degree-minute-second notation and just take the first number
catch {
lat = parseFloat(origLat)
lng = parseFloat(origLng)
}
lat = parseFloat(origLat)
lng = parseFloat(origLng)

if (!lat || !lng)
return false
Expand Down

0 comments on commit a4fc339

Please sign in to comment.