New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add haversine distance calc example #22
Conversation
adds an example for referencing in issue uber#18
87042d4
to
088d905
Compare
examples/distance.c
Outdated
#include <math.h> | ||
#include <stdio.h> | ||
|
||
double dist(double th1, double ph1, double th2, double ph2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is an example, maybe include a comment on the algo here with a link to some reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, would it be better to just expose _geoDistRads
or _geoDistKm
from geoCoord?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could do! i expect cutting out the middle step and creating h3DistKm
would be more valuable and appropriate for this lib, since that's what I'm doing here anyway, but cross that bridge if/when we find the need?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe include a comment on the algo here
done!
examples/distance.c
Outdated
@@ -0,0 +1,61 @@ | |||
/* | |||
* Copyright 2017 Uber Technologies, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it 2018 already?!
examples/distance.c
Outdated
#include <math.h> | ||
#include <stdio.h> | ||
|
||
double dist(double th1, double ph1, double th2, double ph2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment for this function? What are the parameters, is it Haversine distance, etc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK to me; @nrabinowitz raises a good point about publicizing geoDistRads/geoDistKm, but I think this is fine considering the haversine formula seems to be well documented online.
examples/distance.c
Outdated
// 555 Market St @ resolution 15 | ||
H3Index h3HQ2 = stringToH3("8f283082a30e623"); | ||
|
||
double distance = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like double distance
is not used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uh oh, possible to configure linter to catch? compiling with -Wall
catches this...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
publicizing geoDistRads/geoDistKm
I suggest we put out a minor version feature bump with these two and h3DistRads/h3DistKm
; doing that is out of scope for this addition. like I mentioned to @nrabinowitz , I expect the h3 distance functions will be more useful and appropriate than yet another set of geo distance functions.
effbedb
to
c81c042
Compare
Making |
created #23 for tracking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for adding the issue to track the feature addition.
add haversine distance calc example
adds an example for referencing in issue #18