/// <summary> /// Executes the actual algorithm. /// </summary> protected override void DoRun() { // calculate maxOffset in degrees. var offsettedLocation = (new Coordinate(_latitude, _longitude)).OffsetWithDistances(_maxOffsetInMeter); var latitudeOffset = System.Math.Abs(_latitude - offsettedLocation.Latitude); var longitudeOffset = System.Math.Abs(_longitude - offsettedLocation.Longitude); // get the closest edge. uint vertexId = _graph.SearchClosest(_latitude, _longitude, latitudeOffset, longitudeOffset, _isAcceptable); if (vertexId == Constants.NO_EDGE) { // oeps, no edge was found, too far from road network. this.ErrorMessage = string.Format("Could not resolve point at [{0}, {1}]. Probably too far from closest road or outside of the loaded network.", _latitude.ToInvariantString(), _longitude.ToInvariantString()); return; } _result = _graph.CreateRouterPointForVertex(vertexId, _isAcceptable); this.HasSucceeded = true; }