top | item 45736282

Show HN: CoordConversions NPM Module for Map Coordinate Conversions

8 points| smatthewaf | 4 months ago |github.com

I have been working on a project that has multiple repos, all of which have to convert between multiple map coordinate types, so I made an NPM module that allows you to parse and convert between Decimal Degrees, Degrees-Minutes, and Degrees-Minutes-Seconds coordinate types. Niche? Yes. Useful? Also yes (I hope)!

2 comments

order
[+] pheelicks|4 months ago|reply
Nice library. Without trying to start the classic geo-flamewar, do you consider returning the DD coordinates as [longitude, latitude]? This is in line with a number of formats out there, including the popular GeoJSON that is often used in JavaScript apps.

Getting these backwards is a common frustration, so my vote would be for Lon/lat ordering.

Regardless of which you choose, I find DD to be quite cryptic and it would be nicer to spell out the order, eg parseToLonLat - then the order is clear to the user

[+] smatthewaf|3 months ago|reply
Sorry for the late reply! To be honest I hadn't considered it because when I wrote this it was originally to solve a specific problem and that situation always has them in lat/lon rather than lon/lat, but what I'll add to the future to do list is maybe a toggle so if you have them in lon/lat order you can society that and feed them in that way.

I get your point on "DD" being cryptic, I will consider that. Maybe rather than DD, DM, DMS, DecDeg, DegMin, DegMinSec or something slightly more descriptive. Hm.