Skip to content

program hangs while calling geodesicDistanceOnWGS84 #75

Closed

Description

@manasdebashiskar

Hi Experts,
I have a classification program in spark that uses ESRI Geometry library. However my spark program hangs at this stage. Looking at stack dump it seems there is a set of points for which geodesicDistanceOnWGS84 hangs.

Is there such a pair of points for which I am expected to see such behavior?

Stack dump

java.lang.StrictMath.atan2(Native Method)
java.lang.Math.atan2(Math.java:499)
com.esri.core.geometry.GeoDist.geodesic_distance_ngs(GeoDist.java:388)
com.esri.core.geometry.SpatialReferenceImpl.geodesicDistanceOnWGS84Impl(SpatialReferenceImpl.java:233)
com.esri.core.geometry.GeometryEngine.geodesicDistanceOnWGS84(GeometryEngine.java:901)

Activity

  1. stolstov commented on Feb 2, 2015

    @stolstov
    Member

    @manasdebashiskar I am not aware of such behavior. Do you have a repro case to debug?

  2. climbage commented on Feb 2, 2015

    @climbage
    Member

    I just ran a test in Spark using the above GeometryEngine.geodesicDistanceOnWGS84 method and could not get it to hang. It seems strange that it's happening in native Java code. What operating system are you using? Java Version?

  3. manasdebashiskar commented on Feb 7, 2015

    @manasdebashiskar
    Author

    Hi @climbage . Sorry for the delayed response.
    My java version is Oracle JDK 7.45. Centos 6.6
    This behaviour of hanging only happens for certain value of geometry Point.
    My work around was to print the Point before calling geodesicDistanceOnWGS84 function.
    The value of Point that hangs geodesicDistanceOnWGS84 causes printing of the same to crash.
    I catch the exception and don't call geodesicDistanceOnWGS84 for those odd Point values.

    What I have not been able to figure out is in which case I end up creating a Point that manifests this behaviour.

  4. climbage commented on Feb 7, 2015

    @climbage
    Member

    Interesting... It seems like there is an issue with a double value in your point. I'm not sure how that's even possible.

    Do you have the stack trace for when it crashes on print? Also, what is the name of the exception it throw?

  5. randallwhitman commented on Feb 9, 2015

    @randallwhitman
    Contributor

    Another thing you could try is, what happens if you call getX and getY rather than toString (which I assume is being called to print the point)?

  6. movermeyer commented on Dec 21, 2015

    @movermeyer

    I have what I believe is a reproducible test case in #100.

    When trying to compute the distance between a pair of points (using geometry-api-java, 1.2.1), this pair of points seems to hang the library. Here is the code I used (Scala 2.10.5):

    import com.esri.core.geometry.{GeometryEngine, Point, SpatialReference}
    
    object testDistanceFailure {
      val p1 = new Point(-60.668485,-31.996013333333334)
      val p2 = new Point(119.13731666666666,32.251583333333336)
      GeometryEngine.geodesicDistanceOnWGS84(p1,p2)
    }
    
    • Centos 6.7
      • Linux 2.6.32-573.7.1.el6.x86_64
    • Scala 2.10.5
    • java version "1.7.0_91"
      • OpenJDK Runtime Environment (rhel-2.6.2.2.el6_7-x86_64 u91-b00)
      • OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode)
  7. alocke commented on Dec 21, 2015

    @alocke
    Member

    I can reproduce this on Windows using native Java code. We will get this fixed. Thanks!

  8. movermeyer commented on Dec 21, 2015

    @movermeyer

    Here are some other examples of pairs of points:

    • (121.27343833333333, 27.467438333333334) and (-58.55804833333333, -27.035613333333334)
    • (-53.329865, -36.08110166666667) and (126.52895166666667, 35.97385)
    • (-4.7181166667, 36.1160166667) and (175.248925, -35.7606716667)

    Notice that the absolute value of the x values sum to near 180, and the y values are nearly * -1 of each other.

    IDK if you needed more examples or not.

  9. alocke commented on Dec 21, 2015

    @alocke
    Member

    Good observation. I will add these cases to my test suite.

  10. stolstov commented on Dec 21, 2015

    @stolstov
    Member

    @daburrows The issue is in the GeoDist.java. It has bad termination condition.

                    if (PE_ABS(sin_azeq - prev) < tol) {
                        q_continue_looping = false;
                        continue;
                    }
    

    The sin_azeq-prev is stuck around 2e-14, while tol is 1e-14.

  11. movermeyer commented on Dec 22, 2015

    @movermeyer

    Is there any estimate for how long this will take to fix?

    I've got a workaround (for my use case) that simply doesn't attempt to call your code if the difference in longitudes is too great.

    Obviously, this means that I'm unable to do 100% of the computations, but thankfully my use case is OK with some data loss.

  12. added this to the 1.2.2 milestone on Jan 6, 2016
  13. stolstov commented on Jan 7, 2016

    @stolstov
    Member

    fixed

  14. modified the milestones: 2.0.0, 1.2.2 on Aug 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions