You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@streampipes.apache.org by "Florian Micklich (Jira)" <ji...@apache.org> on 2020/05/17 10:34:00 UTC

[jira] [Commented] (STREAMPIPES-131) Increase Accuracy of the Geo Distance Calculation

    [ https://issues.apache.org/jira/browse/STREAMPIPES-131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17109421#comment-17109421 ] 

Florian Micklich commented on STREAMPIPES-131:
----------------------------------------------

Testcase:  
{code:java}
    Double lat_ka = 49.00689;
      Double lng_ka = 8.403653;

      Double lat_NY = 40.730610;
      Double lng_NY = -73.935242;

      SpLengthCalculator tester1 = new SpLengthCalculator(3);
      tester1.calcGeodesicDistanceNew(lat_ka, lng_ka,lat_NY, lng_NY);
      tester1.convertUnit(2);
      double result = tester1.getLengthValue();
{code}

Test-method
{code:java}
 public void calcGeodesicDistanceNew(double lat1, double lng1, double lat2, double lng2) {
    Geodesic geod = Geodesic.WGS84;
    GeodesicData dist =  geod.Inverse(lat1, lng1, lat2, lng2, 1025);
    double result = dist.s12;

    setLength(result, M);
  }
{code}

Result: 6246.970 !

> Increase Accuracy of the Geo Distance Calculation 
> --------------------------------------------------
>
>                 Key: STREAMPIPES-131
>                 URL: https://issues.apache.org/jira/browse/STREAMPIPES-131
>             Project: StreamPipes
>          Issue Type: Improvement
>            Reporter: Florian Micklich
>            Assignee: Florian Micklich
>            Priority: Major
>             Fix For: 0.67.0
>
>
> At the moment the Distance Calculation and Static Distance Calulation are using the using the ‘haversine’ formula [1].
> But the result can be improved:
> Issue:
> Calc distance between Karlsruhe and New York:
> StreamPipes: 6230.166 km
> reference PostGIS: 6246.970 km
> --> Difference of ~17 km or 0,26 % error
> Calc distance between Karlsruhe and Rastatt:
> StreamPipes: 21.87866 km
> reference PostGIS: 21.908 km
> --> Difference of ~0,029 km or 0,13 % error
> Solution:
> Using GeographicLib as Library under MIT Licende [3][4]
> Using Geodesy Algorithm resolving different problems mentions in this paper [5]
> [1] https://www.movable-type.co.uk/scripts/latlong.html
> [3] https://mvnrepository.com/artifact/net.sf.geographiclib/GeographicLib-Java/1.50
> [4] https://geographiclib.sourceforge.io/html/java/
> [5] https://link.springer.com/article/10.1007/s00190-012-0578-z



--
This message was sent by Atlassian Jira
(v8.3.4#803005)