private double DetectTransitStops(Trip trip) { double stops = 0; double transit_stops = 0; foreach (Position pos in trip.TripPositions) { if (pos.Speed == 0 && pos.Accuracy <= 30) { stops++; if (_googleService.NearbyTransit(Convert.ToInt32(pos.Accuracy), pos.Latitude, pos.Longitude)) { transit_stops++; } } } if (stops == 0) { return(0); } return(transit_stops / stops); }