I recently implemented magellan to parse user lat-long inputs for a marine-mammal citizen science platform I am working on. Our director (a whale guy) was not happy with the input parsing in certain edge cases so I added a few lines to address those cases. The cases in particular were:
Space or symbol separated DMD inputs without a decimal such as magellan('12 3'), magellan('12 30'), or magellan('12°3') were parsing as decimal degrees to incorrect values. To address this I added an extra regex looking for symbol patterns indicating that parsing should skip over the DD phase to the DMS/DMD phase.
The .toDD() method was ignoring direction if the decimal evaluated to zero such that magellan('-12').latitude().toDD() and magellan('12S').toDD() both evaluated to 12.0000. This I addressed just by changing the condition for adding a negative sign.
I hope you find these changes helpful. Thanks for the awesome work! We were looking for a way to automatically allow different lat/long formats your package has been a great solution.
Hi,
I recently implemented magellan to parse user lat-long inputs for a marine-mammal citizen science platform I am working on. Our director (a whale guy) was not happy with the input parsing in certain edge cases so I added a few lines to address those cases. The cases in particular were:
magellan('12 3')
,magellan('12 30')
, ormagellan('12°3')
were parsing as decimal degrees to incorrect values. To address this I added an extra regex looking for symbol patterns indicating that parsing should skip over the DD phase to the DMS/DMD phase..toDD()
method was ignoring direction if the decimal evaluated to zero such thatmagellan('-12').latitude().toDD()
andmagellan('12S').toDD()
both evaluated to 12.0000. This I addressed just by changing the condition for adding a negative sign.I hope you find these changes helpful. Thanks for the awesome work! We were looking for a way to automatically allow different lat/long formats your package has been a great solution.