title: Finding if point is left or right to a line (using coordinates!!)
body: <p>I have a point (defined by latitude and longitude) and a line (defined by latitude start+longitude start and latitude end+longitude end).<br/>
  The line is <strong>always</strong> in the direction start =&gt; end, but of course the line can be in any angle of the compass. I only know, my &quot;path&quot; is from &quot;start&quot; to &quot;end&quot; and my position (point) can be on the path, on the left side of the path or on the right side of the path.</p>
  <p>And now my problem is to know on which side of the path is the point. And I really don't have any idea how to get this information.</p>
  <p>I already searched for this algoritm and I found many answer, all based on the formula:</p>
  <pre><code>((b.X - a.X)*(c.Y - a.Y) - (b.Y - a.Y)*(c.X - a.X)) &gt; 0
  </code></pre>
  <p>for example in this post: <a href="https://stackoverflow.com/questions/1560492/how-to-tell-whether-a-point-is-to-the-right-or-left-side-of-a-line">How to tell whether a point is to the right or left side of a line</a><br/>
  Unfortunately, if does <strong>not</strong> work as expected if I use latitude and longitude (I always get the point is &quot;left&quot; of the path) and I really don't understand where is the error...</p>
  <p>My code is:</p>
  <pre><code>  private int isPointLeftOrRight(GeoPoint point, GeoPoint lineStart, GeoPoint lineEnd)
    {
      double ret = (lineEnd.getLongitude() - lineStart.getLongitude()) * (point.getLatitude() - lineStart.getLatitude()) -
                   (lineEnd.getLatitude() - lineStart.getLatitude()) * (point.getLongitude() - lineStart.getLongitude());
      if(ret == 0)
        return 0;
      return (ret &gt; 0) ? 1 : -1;
    }
  </code></pre>
  <p>Can someone explain me where is my error?</p>
  <p>Thank you very very much and happy easter!
  Luca</p>