Skip to content

Commit

Permalink
Merge pull request #13 from bars43ru/issues-11
Browse files Browse the repository at this point in the history
игнорирование координат 9000.0000,N,00000.0000,E
  • Loading branch information
bars43ru authored Sep 21, 2020
2 parents c0027e1 + e49cf67 commit 9f7a57a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/src/**/settings.json
/src/**/Properties
/src/Gps2Yandex.csproj.user
/src/Gps2Yandex/Gps2Yandex.csproj.user
2 changes: 1 addition & 1 deletion src/Gps2Yandex.Model/Services/MonitoringFiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;

using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Primitives;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
Expand Down
12 changes: 10 additions & 2 deletions src/Gps2Yandex.Wialon/Extensions/StreamReaderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,22 @@ public static IEnumerable<GpsPoint> ReadAll(this NetworkStream streamReader)
continue;
}

yield return new GpsPoint(
var point = new GpsPoint(
monitoringNumber: uid,
time: $"{match.Groups["date"].Value}{match.Groups["time"].Value}".ToDateTime(),
latitude: double.Parse(match.Groups["lat1"].Value, CultureInfo.InvariantCulture).ToWGS84(),
longitude: double.Parse(match.Groups["lon1"].Value, CultureInfo.InvariantCulture).ToWGS84(),
speed: int.Parse(match.Groups["speed"].Value),
course: int.Parse(match.Groups["course"].Value)
);
);

// Причина появления этого условия см. https://github.com/bars43ru/gps2Yandex/issues/11
if ((int)point.Latitude == 9000 && (int)point.Longitude == 0)
{
continue;
}

yield return point;
}
}

Expand Down

0 comments on commit 9f7a57a

Please sign in to comment.