Skip to content

Commit 6e64e4d

Browse files
committed
fixes #122
1 parent 4aa20ca commit 6e64e4d

File tree

4 files changed

+44
-5
lines changed

4 files changed

+44
-5
lines changed

DEM.Net.Core/Model/Datasets/DEMDataSet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ private static Dictionary<string, DEMDataSet> GetRegisteredDatasets()
107107
Description = "ALOS World 3D - 30m (nicest but contain void areas)",
108108
PublicUrl = "http://opentopography.sdsc.edu/raster?opentopoID=OTALOS.112016.4326.2",
109109
DataSource = new VRTDataSource("https://opentopography.s3.sdsc.edu/raster/AW3D30/AW3D30_global.vrt"),
110-
FileFormat = new DEMFileDefinition("GeoTiff file", DEMFileType.GEOTIFF, ".tif", DEMFileRegistrationMode.Cell),
110+
FileFormat = new DEMFileDefinition("GeoTiff file", DEMFileType.GEOTIFF, ".tif", DEMFileRegistrationMode.Grid),
111111
ResolutionMeters = 30,
112112
ResolutionArcSeconds = 1,
113113
PointsPerDegree = 3600,

DEM.Net.Core/Services/Geometry/GeometryService.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,9 @@
2727
using System.Collections.Generic;
2828
using System.Globalization;
2929
using System.Linq;
30-
using System.Text;
31-
using System.Threading.Tasks;
3230
using NetTopologySuite.Geometries;
3331
using NetTopologySuite.IO;
3432
using NetTopologySuite.Operation.Union;
35-
using SixLabors.ImageSharp.PixelFormats;
3633

3734
namespace DEM.Net.Core
3835
{

DEM.Net.xUnit.Test/ElevationTests.cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,5 +176,47 @@ public void TestIntervisibilityWithInitialAltitude(string dataSetName, double la
176176
Assert.Equal(expectedObstacles, report.Metrics.Obstacles.Count, 0);
177177

178178
}
179+
180+
[Fact]
181+
public void IntervisibilityTest()
182+
{
183+
var boundingBox = new BoundingBox(-114.81670660619355, -114.79753117282172, 50.887605382989769, 50.8997005129077);
184+
var dataSet = DEMDataSet.RegisteredNonLocalDatasets.First(x => x.Name == "AW3D30");
185+
_elevationService.DownloadMissingFiles(dataSet, boundingBox);
186+
187+
var start = new GeoPoint
188+
{
189+
Elevation = 1876.8404541015625,
190+
Latitude = 50.89365334058617,
191+
Longitude = -114.80711764454496
192+
};
193+
194+
var end = new GeoPoint
195+
{
196+
Elevation = 2111.0537109375,
197+
Latitude = 50.885127771762058,
198+
Longitude = -114.80711764454496,
199+
DistanceFromOriginMeters = 949.06197559241423
200+
};
201+
202+
var result = _elevationService.GetIntervisibilityReport(new List<GeoPoint> { start, end }, 0, 0);
203+
204+
}
205+
206+
[Theory()]
207+
[InlineData(nameof(DEMDataSet.AW3D30), 50.89365334058617, -114.80711764454496, 50.885127771762058, -114.80711764454496, 1)]
208+
[InlineData(nameof(DEMDataSet.SRTM_GL3), 50.89365334058617, -114.80711764454496, 50.885127771762058, -114.80711764454496, 1)]
209+
public void TestIntervisibility2(string dataSetName, double latStart, double lonStart
210+
, double latEnd, double lonEnd, double expectedObstacles)
211+
{
212+
DEMDataSet dataSet = DEMDataSet.RegisteredDatasets.FirstOrDefault(d => d.Name == dataSetName);
213+
Assert.NotNull(dataSet);
214+
215+
IntervisibilityReport report = _elevationService.GetIntervisibilityReport(new GeoPoint(latStart, lonStart), new GeoPoint(latEnd, lonEnd), dataSet);
216+
217+
Assert.NotNull(report);
218+
Assert.Equal(expectedObstacles, report.ObstacleCount, 0);
219+
Assert.Equal(expectedObstacles, report.Metrics.Obstacles.Count, 0);
220+
}
179221
}
180222
}

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<VersionPrefix>8.0.0</VersionPrefix>
3+
<VersionPrefix>8.0.1</VersionPrefix>
44
<LangVersion>latest</LangVersion>
55
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
66
<TargetFramework>net8.0</TargetFramework>

0 commit comments

Comments
 (0)