public void CovertGeoJsonToGpx_OnlyOnePoint_ShouldBeConverted() { GpxFile gpx = new GpxFile(); gpx.Waypoints.Add(new GpxWaypoint((GpxLongitude)1, (GpxLatitude)1).WithName("name")); var featureCollection = _gpxGeoJsonConverter.ToGeoJson(gpx); Assert.AreEqual(1, featureCollection.Count); var point = featureCollection.Select(f => f.Geometry).OfType <Point>().FirstOrDefault(); Assert.IsNotNull(point); var coordinates = point.Coordinate; Assert.IsNotNull(coordinates); Assert.AreEqual(gpx.Waypoints[0].Name, featureCollection.First().Attributes[FeatureAttributes.NAME]); Assert.IsTrue(double.IsNaN(coordinates.Z)); Assert.AreEqual(gpx.Waypoints[0].Latitude, coordinates.Y); Assert.AreEqual(gpx.Waypoints[0].Longitude, coordinates.X); }
public void CovertGeoJsonToGpx_OnlyOnePoint_ShouldBeConverted() { gpxType gpx = new gpxType { wpt = new[] { new wptType { lat = 1, lon = 2, ele = 3, eleSpecified = false, name = "point" } } }; var featureCollection = _gpxGeoJsonConverter.ToGeoJson(gpx); Assert.AreEqual(1, featureCollection.Features.Count); var point = featureCollection.Features.Select(f => f.Geometry).OfType <Point>().FirstOrDefault(); Assert.IsNotNull(point); var coordinates = point.Coordinate; Assert.IsNotNull(coordinates); Assert.AreEqual(gpx.wpt[0].name, featureCollection.Features.First().Attributes["name"]); Assert.IsTrue(double.IsNaN(coordinates.Z)); Assert.AreEqual(gpx.wpt[0].lat, (decimal)coordinates.Y); Assert.AreEqual(gpx.wpt[0].lon, (decimal)coordinates.X); }
///<inheritdoc /> public byte[] Transform(byte[] content) { return(_gpxGeoJsonConverter.ToGeoJson(content.ToGpx()).ToBytes()); }