Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/22/12 19:14:33 (12 years ago)
Author:
spimming
Message:

#1894:

  • extended datasource interface to get routing graph for a specific vehicle type
  • use ICostCalculator to calculate edge weights
  • moved common enums in own file
  • removed method to estimate cost from graph; use ICostCalculator
Location:
branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Data.DIMACS/DIMACSDataSource.cs

    r8516 r8520  
    11using System;
    22using System.IO;
     3using HeuristicLab.Problems.RoutePlanning.Data.Core;
    34using HeuristicLab.Problems.RoutePlanning.Interfaces;
    45using HeuristicLab.Problems.RoutePlanning.RoutingGraph;
     
    2324    public IGraph GetRoutingGraph() {
    2425      return graph;
     26    }
     27
     28    public IGraph GetRoutingGraph(VehicleType vehicle) {
     29      throw new NotImplementedException();
    2530    }
    2631
     
    103108              Vertex vDst = graph.GetVertex(dst);
    104109
    105               Edge<Vertex> edge = new Edge<Vertex>(vSrc, vDst);
    106               edge.Weight = len;
     110              Edge<Vertex> edgeForward = new Edge<Vertex>(vSrc, vDst);
     111              edgeForward.Weight = len;
    107112
    108               graph.AddEdge(edge);
     113              Edge<Vertex> edgeBackward = new Edge<Vertex>(vSrc, vDst);
     114              edgeBackward.Weight = len;
    109115
     116              graph.AddEdge(edgeForward);
     117              graph.AddEdge(edgeBackward);
    110118            }
    111119            s = string.Empty;
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Data.Osm.Core/Way.cs

    r8516 r8520  
    22using System;
    33using System.Collections.Generic;
     4using HeuristicLab.Problems.RoutePlanning.Data.Core;
    45namespace HeuristicLab.Problems.RoutePlanning.Data.Osm.Core {
    5   #region Highway Types
    6 
    7   // see: https://wiki.openstreetmap.org/wiki/Key:highway
    8   public enum HighwayType {
    9     null_type,
    10     motorway,
    11     motorway_link,
    12     trunk,
    13     trunk_link,
    14     primary,
    15     primary_link,
    16     secondary,
    17     secondary_link,
    18     tertiary,
    19     tertiary_link,
    20     living_street,
    21     pedestrian,
    22     residential,
    23     unclassified,
    24     service,
    25     track,
    26     bus_guideway,
    27     raceway,
    28     road,
    29     path,
    30     footway,
    31     cycleway,
    32     bridleway,
    33     steps
    34   }
    35 
    36   #endregion
    37 
    386  public class Way : OsmBase {
    397    private List<Node> nodes;
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Data.Osm/OsmDataSource.cs

    r8516 r8520  
    33using System.IO;
    44using System.Xml;
     5using HeuristicLab.Problems.RoutePlanning.Data.Core;
     6using HeuristicLab.Problems.RoutePlanning.Data.Osm.Core;
    57using HeuristicLab.Problems.RoutePlanning.Interfaces;
    68using HeuristicLab.Problems.RoutePlanning.RoutingGraph;
    7 using HeuristicLab.Problems.RoutePlanning.Data.Osm.Core;
    89
    910namespace HeuristicLab.Problems.RoutePlanning.Data.Osm {
    1011  public class OsmDataSource : IDataSource {
    1112    private FileInfo file;
     13    private ICostCalculator costCalculator;
     14    private IGraph graph;
    1215    private Dictionary<long, Vertex> vertices;
    13     private IGraph graph;
    14 
    15     public OsmDataSource(string filename) {
     16
     17    public OsmDataSource(string filename)
     18      : this(filename, new TravelTimeCostCalculator()) {
     19    }
     20
     21    public OsmDataSource(string filename, ICostCalculator costCalc) {
    1622      file = new FileInfo(filename);
     23      costCalculator = costCalc;
    1724      graph = new Graph();
    1825      vertices = new Dictionary<long, Vertex>();
     
    2532    public IGraph GetRoutingGraph() {
    2633      return graph;
     34    }
     35
     36    public IGraph GetRoutingGraph(VehicleType vehicle) {
     37      throw new NotImplementedException();
    2738    }
    2839
     
    103114            Vertex v2 = way[i + 1];
    104115            graph.AddVertex(v2);
    105             short vertexCategory = (short)category;
     116            //short vertexCategory = (short)category;
     117            float weight = costCalculator.CalculateCosts(v1, v2, category);
    106118            if (oneWayRoad) {
    107               Edge<Vertex> edge = new Edge<Vertex>(v1, v2, vertexCategory);
     119              Edge<Vertex> edge = new Edge<Vertex>(v1, v2, weight);
    108120              graph.AddEdge(edge);
    109121            } else {
    110               Edge<Vertex> edgeForward = new Edge<Vertex>(v1, v2, vertexCategory);
     122              Edge<Vertex> edgeForward = new Edge<Vertex>(v1, v2, weight);
    111123              graph.AddEdge(edgeForward);
    112124
    113               Edge<Vertex> edgeBackward = new Edge<Vertex>(v2, v1, vertexCategory);
     125              Edge<Vertex> edgeBackward = new Edge<Vertex>(v2, v1, weight);
    114126              graph.AddEdge(edgeBackward);
    115127            }
     
    201213            Vertex v2 = way[i + 1];
    202214            graph.AddVertex(v2);
    203             short vertexCategory = (short)category;
     215            //short vertexCategory = (short)category;
     216            float weight = costCalculator.CalculateCosts(v1, v2, category);
    204217            if (oneWayRoad) {
    205               Edge<Vertex> edge = new Edge<Vertex>(v1, v2, vertexCategory);
     218              Edge<Vertex> edge = new Edge<Vertex>(v1, v2, weight);
    206219              graph.AddEdge(edge);
    207220            } else {
    208               Edge<Vertex> edgeForward = new Edge<Vertex>(v1, v2, vertexCategory);
     221              Edge<Vertex> edgeForward = new Edge<Vertex>(v1, v2, weight);
    209222              graph.AddEdge(edgeForward);
    210223
    211               Edge<Vertex> edgeBackward = new Edge<Vertex>(v2, v1, vertexCategory);
     224              Edge<Vertex> edgeBackward = new Edge<Vertex>(v2, v1, weight);
    212225              graph.AddEdge(edgeBackward);
    213226            }
     
    218231      }
    219232    }
     233
     234    //private float CalculateWeight(Vertex s, Vertex t, HighwayType ht) {
     235    //  double distanceKms = Utils.LocationDistance(s.Logitude, s.Latitude, t.Logitude, t.Latitude);
     236    //  double weight = distanceKms;
     237    //  return (float)weight;
     238    //}
     239
     240    //private float CalculateWeight(Vertex s, Vertex t, HighwayType ht) {
     241    //  double distanceKms = Utils.LocationDistance(s.Logitude, s.Latitude, t.Logitude, t.Latitude);
     242    //  int speedKmH = GetMaxSpeed(ht);
     243    //  double weight = (distanceKms / speedKmH) * 60;
     244    //  return (float)weight;
     245    //}
    220246  }
    221247}
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/HeuristicLab.Problems.RoutePlanning.csproj

    r8516 r8520  
    5757  </ItemGroup>
    5858  <ItemGroup>
     59    <Compile Include="Data.Core\Enums.cs" />
    5960    <Compile Include="Data.DIMACS\DIMACSDataSource.cs" />
     61    <Compile Include="Interfaces\ICostCalculator.cs" />
    6062    <Compile Include="RoutingGraph\EarthDistanceCostCalculator.cs" />
    61     <Compile Include="Interfaces\ICostCalculator.cs" />
    6263    <Compile Include="RoutingGraph\Edge.cs" />
    6364    <Compile Include="RoutingGraph\Graph.cs" />
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Interfaces/ICostCalculator.cs

    r8516 r8520  
    11
     2using HeuristicLab.Problems.RoutePlanning.Data.Core;
    23using HeuristicLab.Problems.RoutePlanning.RoutingGraph;
    34namespace HeuristicLab.Problems.RoutePlanning.Interfaces {
    45  public interface ICostCalculator {
    56    float Costs(Edge<Vertex> edge);
     7    float CalculateCosts(Vertex source, Vertex destination, HighwayType category);
    68    float EstimatedCosts(Vertex source, Vertex destination);
    79  }
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Interfaces/IDataSource.cs

    r8516 r8520  
    11
     2using HeuristicLab.Problems.RoutePlanning.Data.Core;
    23namespace HeuristicLab.Problems.RoutePlanning.Interfaces {
    34  public interface IDataSource {
    45    IGraph GetRoutingGraph();
     6    IGraph GetRoutingGraph(VehicleType vehicle);
    57  }
    68}
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Interfaces/IGraph.cs

    r8516 r8520  
    2020    int GetInDegree(long id);
    2121
    22     float EstimatedCosts(long sourceId, long targetId);
     22    //float EstimatedCosts(long sourceId, long targetId);
    2323  }
    2424}
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/RoutingGraph/EarthDistanceCostCalculator.cs

    r8516 r8520  
    1 using System;
     1using HeuristicLab.Problems.RoutePlanning.Data.Core;
    22using HeuristicLab.Problems.RoutePlanning.Interfaces;
     3using HeuristicLab.Problems.RoutePlanning.Utilities;
    34
    45namespace HeuristicLab.Problems.RoutePlanning.RoutingGraph {
    56  public class EarthDistanceCostCalculator : ICostCalculator {
    6     private const double earthMeanRadius = 6371.0 * 1000.0;
    7 
    87    #region ICostCalculator Members
    98
     
    1211    }
    1312
     13    public float CalculateCosts(Vertex source, Vertex destination, HighwayType category) {
     14      double distanceKms = Utils.LocationDistance(source.Logitude, source.Latitude,
     15                                            destination.Logitude, destination.Latitude);
     16      double weight = distanceKms;
     17      return (float)weight;
     18    }
     19
    1420    public float EstimatedCosts(Vertex source, Vertex destination) {
    15       return (float)EarthDistance(source.Logitude, source.Latitude, destination.Logitude, destination.Latitude);
     21      double distanceKms = Utils.LocationDistance(source.Logitude, source.Latitude,
     22                                            destination.Logitude, destination.Latitude);
     23      double weight = distanceKms;
     24      return (float)weight;
    1625    }
    1726
    1827    #endregion
    19 
    20     private double DegToRad(double alpha) {
    21       return alpha * Math.PI / 180;
    22     }
    23 
    24     private double AngularDistance(double startLon, double startLat, double endLon, double endLat) {
    25       double lat1 = DegToRad(startLat);
    26       double lat2 = DegToRad(endLat);
    27       double long1 = DegToRad(startLon);
    28       double long2 = DegToRad(endLat);
    29 
    30       double x = Math.Sin(lat1) * Math.Sin(lat2) + Math.Cos(lat1) * Math.Cos(lat2) * Math.Cos(long1 - long2);
    31       x = Math.Min(1, Math.Max(0, x));
    32 
    33       return Math.Acos(x);
    34     }
    35 
    36     private double EarthDistance(double startLon, double startLat, double endLon, double endLat) {
    37       return earthMeanRadius * AngularDistance(startLon, startLat, endLon, endLat);
    38     }
    3928  }
    4029}
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/RoutingGraph/Edge.cs

    r8516 r8520  
    1313    }
    1414
    15     private short category;
    16     public short Category {
    17       get { return category; }
    18       set { category = value; }
    19     }
     15    //private short category;
     16    //public short Category {
     17    //  get { return category; }
     18    //  set { category = value; }
     19    //}
    2020
    2121    private float weight;
     
    3030    }
    3131
    32     public Edge(Vertex source, Vertex target, short category) {
     32    public Edge(Vertex source, Vertex target, float weight) {
    3333      this.source = source;
    3434      this.target = target;
    35       this.category = category;
     35      this.weight = weight;
    3636    }
    3737
     
    5151      return source.GetHashCode() ^ target.GetHashCode();
    5252    }
    53 
    54     public int GetMaxSpeed() {
    55       int speed = 0;
    56 
    57       //TODO:
    58       switch (category) {
    59         case 23:
    60         case 17:
    61         case 18:
    62         case 22:
    63         case 21:
    64         case 24:
    65         case 16:
    66         case 20:
    67         case 15:
    68         case 12:
    69         case 0:
    70           speed = 1;
    71           break;
    72 
    73         case 11:
    74         case 14:
    75           speed = 15;
    76           break;
    77 
    78         case 19:
    79           speed = 30;
    80           break;
    81 
    82         case 9:
    83         case 10:
    84         case 7:
    85         case 8:
    86           speed = 80;
    87           break;
    88 
    89         case 13:
    90           speed = 50;
    91           break;
    92 
    93         case 3:
    94         case 4:
    95         case 5:
    96         case 6:
    97           speed = 100;
    98           break;
    99 
    100         case 1:
    101         case 2:
    102           speed = 130;
    103           break;
    104 
    105         default:
    106           speed = 1;
    107           break;
    108       }
    109       return speed;
    110     }
    11153  }
    11254}
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/RoutingGraph/Graph.cs

    r8516 r8520  
    33using System.Collections.Generic;
    44using HeuristicLab.Problems.RoutePlanning.Interfaces;
    5 using HeuristicLab.Problems.RoutePlanning.Utilities;
    65namespace HeuristicLab.Problems.RoutePlanning.RoutingGraph {
    76  public class Graph : IGraph {
     
    126125      foreach (Edge<Vertex> edge in edges) {
    127126        // TODO: check if edge can be traversed (eg. highway tag for car roads, ...)
    128         float weight = GetWeight(edge); // TODO:  edge.Weight?
    129         neighbors[edge.Target.Id] = weight;
     127        //float weight = GetWeight(edge); // TODO:  edge.Weight?
     128        //neighbors[edge.Target.Id] = weight;
     129        neighbors[edge.Target.Id] = edge.Weight;
    130130      }
    131131      return neighbors;
     
    136136      foreach (Edge<Vertex> edge in edges) {
    137137        // TODO: check if edge can be traversed (eg. highway tag for car roads, ...)
    138         float weight = GetWeight(edge); // TODO:  edge.Weight?
    139         neighbors[edge.Source.Id] = weight;
     138        //float weight = GetWeight(edge); // TODO:  edge.Weight?
     139        //neighbors[edge.Source.Id] = weight;
     140        neighbors[edge.Source.Id] = edge.Weight;
    140141      }
    141142      return neighbors;
    142143    }
    143144
    144     public float GetWeight(Edge<Vertex> edge) {
    145       //double distance = Utils.Distance(edge.Source.Logitude, edge.Source.Latitude,
    146       //                                 edge.Target.Logitude, edge.Target.Latitude);
     145    //public float GetWeight(Edge<Vertex> edge) {
     146    //  //double distance = Utils.Distance(edge.Source.Logitude, edge.Source.Latitude,
     147    //  //                                 edge.Target.Logitude, edge.Target.Latitude);
    147148
    148       PointD s = new PointD(edge.Source.Logitude, edge.Source.Latitude);
    149       PointD t = new PointD(edge.Target.Logitude, edge.Target.Latitude);
    150       double distance = Utils.LocationDistance(s, t);
     149    //  PointD s = new PointD(edge.Source.Logitude, edge.Source.Latitude);
     150    //  PointD t = new PointD(edge.Target.Logitude, edge.Target.Latitude);
     151    //  double distance = Utils.LocationDistance(s, t);
    151152
    152       int speed = edge.GetMaxSpeed();
    153       double weight = (distance / speed) * 60;
    154       //double weight = (distance / speed) * 3.6;
    155       //double weight = (distance / speed);
    156       //double weight = distance;
    157       return (float)weight;
    158     }
     153    //  //int speed = edge.GetMaxSpeed();
     154    //  //double weight = (distance / speed) * 60;
     155    //  //double weight = (distance / speed) * 3.6;
     156    //  //double weight = (distance / speed);
     157    //  //double weight = distance;
     158    //  //return (float)weight;
     159    //  return (float)1;
     160    //}
    159161
    160     public float EstimatedCosts(long sourceId, long targetId) {
    161       Vertex source = GetVertex(sourceId);
    162       Vertex target = GetVertex(targetId);
    163       return EstimatedCosts(source, target);
    164     }
     162    //public float EstimatedCosts(long sourceId, long targetId) {
     163    //  Vertex source = GetVertex(sourceId);
     164    //  Vertex target = GetVertex(targetId);
     165    //  return EstimatedCosts(source, target);
     166    //}
    165167
    166     public float EstimatedCosts(Vertex source, Vertex target) {
    167       //double distance = Utils.Distance(source.Logitude, source.Latitude,
    168       //                                 target.Logitude, target.Latitude);
     168    //public float EstimatedCosts(Vertex source, Vertex target) {
     169    //  //double distance = Utils.Distance(source.Logitude, source.Latitude,
     170    //  //                                 target.Logitude, target.Latitude);
    169171
    170       PointD s = new PointD(source.Logitude, source.Latitude);
    171       PointD t = new PointD(target.Logitude, target.Latitude);
    172       double distance = Utils.LocationDistance(s, t);
     172    //  PointD s = new PointD(source.Logitude, source.Latitude);
     173    //  PointD t = new PointD(target.Logitude, target.Latitude);
     174    //  double distance = Utils.LocationDistance(s, t);
    173175
    174       //int speed = 130;
    175       //int speed = 10;
    176       int speed = 130;
    177       double costs = (distance / speed) * 60;
    178       //double costs = (distance / speed) * 3.6;
    179       //double costs = (distance / speed);
    180       //double costs = distance;
    181       return (float)costs;
    182     }
     176    //  //int speed = 130;
     177    //  //int speed = 10;
     178    //  int speed = 130;
     179    //  double costs = (distance / speed) * 60;
     180    //  //double costs = (distance / speed) * 3.6;
     181    //  //double costs = (distance / speed);
     182    //  //double costs = distance;
     183    //  return (float)costs;
     184    //}
    183185  }
    184186}
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/RoutingGraph/TravelTimeCostCalculator.cs

    r8516 r8520  
    11
     2using HeuristicLab.Problems.RoutePlanning.Data.Core;
    23using HeuristicLab.Problems.RoutePlanning.Interfaces;
    34using HeuristicLab.Problems.RoutePlanning.Utilities;
     
    78
    89    public float Costs(Edge<Vertex> edge) {
    9       double distance = Utils.Distance(edge.Source.Logitude, edge.Source.Latitude,
    10                                        edge.Target.Logitude, edge.Target.Latitude);
     10      //double distance = Utils.Distance(edge.Source.Logitude, edge.Source.Latitude,
     11      //                                 edge.Target.Logitude, edge.Target.Latitude);
    1112      //double distance = Utils.LocationDistance(source.Node.Point, target.Node.Point);
    12       int speed = edge.GetMaxSpeed();
    13       double weight = (distance / speed) * 3.6;
     13      //int speed = edge.GetMaxSpeed();
     14      //double weight = (distance / speed) * 3.6;
    1415      //double weight = (distance / speed);
     16      //return (float)1;
     17      return edge.Weight;
     18    }
     19
     20    public float CalculateCosts(Vertex source, Vertex destination, HighwayType category) {
     21      double distanceKms = Utils.Distance(source.Logitude, source.Latitude,
     22                                          destination.Logitude, destination.Latitude);
     23      int speedKmH = GetMaxSpeed(category);
     24      double weight = (distanceKms / speedKmH) * 60;
    1525      return (float)weight;
    1626    }
    1727
    1828    public float EstimatedCosts(Vertex source, Vertex destination) {
    19       double distance = Utils.Distance(source.Logitude, source.Latitude,
    20                                        destination.Logitude, destination.Latitude);
     29      //double distance = Utils.Distance(source.Logitude, source.Latitude,
     30      //                                 destination.Logitude, destination.Latitude);
    2131      //double distance = Utils.LocationDistance(source.Node.Point, target.Node.Point);
    22       int speed = 130;
    23       double costs = (distance / speed) * 3.6;
     32      int speedKmH = 130;
     33      //double costs = (distance / speed) * 3.6;
    2434      //double costs = (distance / speed);
    25       return (float)costs;
     35      //return (float)costs;
     36      double distanceKms = Utils.Distance(source.Logitude, source.Latitude,
     37                                          destination.Logitude, destination.Latitude);
     38      double weight = (distanceKms / speedKmH) * 60;
     39      return (float)weight;
     40    }
     41
     42    private int GetMaxSpeed(short category) {
     43      int speed = 0;
     44
     45      //TODO:
     46      switch (category) {
     47        case 23:
     48        case 17:
     49        case 18:
     50        case 22:
     51        case 21:
     52        case 24:
     53        case 16:
     54        case 20:
     55        case 15:
     56        case 12:
     57        case 0:
     58          speed = 1;
     59          break;
     60
     61        case 11:
     62        case 14:
     63          speed = 15;
     64          break;
     65
     66        case 19:
     67          speed = 30;
     68          break;
     69
     70        case 9:
     71        case 10:
     72        case 7:
     73        case 8:
     74          speed = 80;
     75          break;
     76
     77        case 13:
     78          speed = 50;
     79          break;
     80
     81        case 3:
     82        case 4:
     83        case 5:
     84        case 6:
     85          speed = 100;
     86          break;
     87
     88        case 1:
     89        case 2:
     90          speed = 130;
     91          break;
     92
     93        default:
     94          speed = 1;
     95          break;
     96      }
     97      return speed;
     98    }
     99
     100    public int GetMaxSpeed(HighwayType ht) {
     101      int speed = 0;
     102
     103      //TODO:
     104      switch (ht) {
     105        case HighwayType.bridleway:
     106        case HighwayType.bus_guideway:
     107        case HighwayType.raceway:
     108        case HighwayType.cycleway:
     109        case HighwayType.footway:
     110        case HighwayType.steps:
     111        case HighwayType.null_type:
     112          speed = 1;
     113          break;
     114
     115        case HighwayType.path:
     116        case HighwayType.service:
     117        case HighwayType.pedestrian:
     118        case HighwayType.living_street:
     119          speed = 15;
     120          break;
     121
     122        case HighwayType.road:
     123        case HighwayType.track:
     124          speed = 30;
     125          break;
     126
     127        case HighwayType.tertiary:
     128        case HighwayType.tertiary_link:
     129        case HighwayType.secondary:
     130        case HighwayType.secondary_link:
     131          speed = 80;
     132          break;
     133
     134        case HighwayType.unclassified:
     135        case HighwayType.residential:
     136          speed = 50;
     137          break;
     138
     139        case HighwayType.trunk:
     140        case HighwayType.trunk_link:
     141        case HighwayType.primary:
     142        case HighwayType.primary_link:
     143          speed = 100;
     144          break;
     145        case HighwayType.motorway:
     146        case HighwayType.motorway_link:
     147          speed = 130;
     148          break;
     149
     150        default:
     151          speed = 1;
     152          break;
     153      }
     154      return speed;
    26155    }
    27156
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Utilities/Utils.cs

    r8516 r8520  
    1717
    1818    public static double LocationDistance(PointD p1, PointD p2) {
     19      return LocationDistance(p1.X, p1.Y, p2.X, p2.Y);
     20    }
     21
     22    // calculates the distance of the 2 given locations in kilometers
     23    public static double LocationDistance(double startX, double startY, double endX, double endY) {
    1924      // The Haversine formula
    2025      /* dlon = lon2 - lon1
     
    2530       */
    2631
    27       double lat1Rad = p1.Y * (Math.PI / 180.0);
    28       double long1Rad = p1.X * (Math.PI / 180.0);
    29       double lat2Rad = p2.Y * (Math.PI / 180.0);
    30       double long2Rad = p2.X * (Math.PI / 180.0);
     32      double lat1Rad = startY * (Math.PI / 180.0);
     33      double long1Rad = startX * (Math.PI / 180.0);
     34      double lat2Rad = endY * (Math.PI / 180.0);
     35      double long2Rad = endX * (Math.PI / 180.0);
    3136
    3237      double longitude = long2Rad - long1Rad;
     
    3944      double c = 2.0 * Math.Asin(Math.Sqrt(a));
    4045
    41       const double earthRadiusKms = 6376.5;
     46      const double earthRadiusKms = 6367.5;
    4247      double distance = earthRadiusKms * c;
    4348
Note: See TracChangeset for help on using the changeset viewer.