elliotstokes / gpx-parse

GPX parser
MIT License
44 stars 40 forks source link

Metric System? #10

Closed radiodario closed 8 years ago

radiodario commented 8 years ago

Hi there, thank you so much for this library, it's super useful.

Is there an option for the parser to return km rather than miles? I see the software is hard-coded to use miles for distances (track lengths etc) but meters for elevations. Wouldn't it make more sense to return everything in metric or everything in imperial?

if so, would you accept a PR that defaults to metric?

Thanks

Dario

elliotstokes commented 8 years ago

Hey. Yeah I think the best would be to return metric. Sure I would accept a PR. Maybe it should optionally accept a flag to return in imperial if a user wanted it to.

elliotstokes commented 8 years ago

If I get chance I will implement tonight. If not I would be happy for you to do it. It should be pretty easy. Its just matter of calculating with the great circle radius in km instead I think.

https://github.com/elliotstokes/gpx-parse/blob/master/lib/geomUtils.js#L37

radiodario commented 8 years ago

No no, hold your horses, i've implemented it on my fork and updated the tests :)

elliotstokes commented 8 years ago

Brilliant. Thanks a lot

radiodario commented 8 years ago

i've just added a PR

elliotstokes commented 8 years ago

Brilliant. Ill add the browserify command into the package.json. all looks good will commit now.