Skip to content
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

units in GreatCircle.sphericalDistance()? #29

Open
jx5c opened this issue Jun 1, 2016 · 2 comments
Open

units in GreatCircle.sphericalDistance()? #29

jx5c opened this issue Jun 1, 2016 · 2 comments

Comments

@jx5c
Copy link

jx5c commented Jun 1, 2016

The GreatCircle.sphericalDistance() expects parameters in the units of radians, but several invocations of GreatCircle.sphericalDistance() seem using latitude and longitude in the units of degree:

in Route.java, two invocations:

double timeLimitBase = GreatCircle.sphericalDistance(toLat, toLon, fromLat, fromLon)
                / worstConvoySpeed;

double crowsPathDistance = GreatCircle.sphericalDistance(toLat, toLon, nextLoc.getY(), nextLoc.getX());

in Road.java, two invocations:

kilometers += GreatCircle.sphericalDistance(prevPoint.getY(), prevPoint.getX(), thisPoint.getY(), thisPoint.getX());

double thisLength = GreatCircle.sphericalDistance(prevLat, prevLon, thisLat, thisLon);

These four statements are all invoked with arguments in units of degree.

Also, in the Road.java file, in the statement after the last invocation above,
if (thisLength >= kilometers) {

it compares kilometers with thisLength. The variable thisLength should represent arc distance, in the units of radians, not kilometers.

Jian

@dfdietrick
Copy link
Contributor

Thanks for updates - interesting tool you must be using, is that part of your research?

@jx5c
Copy link
Author

jx5c commented Jun 2, 2016

In fact, it is. I developed a prototype that supports adding semantic information from the real-world context to program elements, thereby enable checking more constraints/rules.

In your project, what I did was adding some units information to several files, e.g., geo.java, and LatLonPoint.java, and run an inference algorithm to propagate the units. Then, the prototype checked the whole project, and revealed some candidate errors. Up to now, I am still trying to understand the details of OpenMap. I hope I can contribute more in the future.

I have used my prototype for a few other Geographic applications, OpenMap is actually the largest one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants