dem-net / dem.net Goto Github PK
View Code? Open in Web Editor NEWDigital Elevation model library in C#. 3D terrain models, line/point Elevations, intervisibility reports
Home Page: https://elevationapi.com
License: Other
Digital Elevation model library in C#. 3D terrain models, line/point Elevations, intervisibility reports
Home Page: https://elevationapi.com
License: Other
Describe the bug
When trying to get elevation data from the ASTER_GDEMV3 dataset, there is always null returned. As it turns out, when trying see if some of the DEM files are missing, the ElevationService
cannot find a coverage for the given coordiantes (screenshot). Then no files are downloaded and therefore the elevation service cannot extract the needed data for the given point (second warning in screenshot) and returns null.
To Reproduce
Can be reproduced with the ElevationSample.cs from the sample repository.
In my project I use DEMNet the get data from a geometry line but in the sample repo it can be reproduced with both, the single point elevation and the geometry line.
Expected behavior
The missing files should be downloaded and then a valid GeoPoint should be returned.
Desktop (please complete the following information):
OS: Win10
Fails for .net core 3.1 & .net6
Fails for DEMNet 0.2.8 & 0.3.2
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
I would like to be able to have .terrain quantized mesh terrain tiles for use in CesiumJS and HarpGL in addition to gltf/glb export option.
Describe alternatives you've considered
Cesium Terrain Builder
Additional context
Very cool project
we are building mobile app Earth Explorer 3D Map App http://earthexplorer.world that supports both gltf/glb, 3DTiles and quantized mesh terrain tiles offline and streaming from the web.
Since this is most powerful landscapeModel->glb tool, I'd like to propose some idea.
Transfer OSGB to glb, while most of the reality models are in this format?
preocedures might like this:
(1) extract the same Level of OSGB to the same folder(f1);
(2) merge all the osgb files in f1 into one osgb(osg1)
(3) transfer osg1 -> GeoTiff -> glb
Describe alternatives you've considered
osgb->obj->glb
looks the right way, but not working.
Describe the bug
When generating a 3D model, the texture contains a lot of black areas.
However, this issue doesn't occur with satellite imagery (MapBox-Satellite, Esri.WorldImagery), but with all the non-satellite imagery providers, e.g. ThunderForest-Outdoors, MapBox-Streets, Stamen-Toner, etc.
It seems that the downloaded image tiles are not processed correctly.
I tested it for different regions and with low, medium, and high image quality settings.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A rendered texture without black areas.
Desktop (please complete the following information):
Additional context
When choosing some imagery providers, e.g. "MapBox-Outdoors", error code Response status code does not indicate success: 410 (Gone).
gets returned.
is it possible to download the globally available ASTER dem data for antartica
Hello,
I've noticed something weird in GeoTiff.ParseMetadata
. I'm not sure whether it's a bug or if I missed something.
In the following line
double pixelSizeY = BitConverter.ToDouble(modelPixelScale, 8) * -1;
Why is the value multiplied by -1
?
Describe the bug
When trying to get the missing files for the dataset 'AW3D30' an exception gets thrown.
To Reproduce
Can be reproduced with the ElevationSample.cs from the sample repository.
In my project I use DEMNet the get data from a geometry line but in the sample repo it can be reproduced with both, the single point elevation and the geometry line.
Expected behavior
Downloading the files and then get the elevation for the given geometry line.
Desktop (please complete the following information):
Describe the bug
Null reference exception is shown in _rasterIndexServiceResolver when I click on "Generate Real Points" button. Null value is set in _rasterIndexServiceResolver during initialization of RasterService.cs class of DEM.NET.Core project.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I want to generate real point and create dtm models.
Screenshots
My Error screenshot
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
Hi
tried to get elevation with a huge list of about 2700 points.
https://github.com/sk-zk/TruckLib/blob/b258f1f8f881c68db2b3c6409a43ce4b40e13fad/Samples/02-RealRoad/ElevationProvider.cs#L27
Elevation values matches to Lat,Long. But the returned values are mixed up
JavaScript library for DOM operations
path: /DEM.Net/DEM.Net.WebApi/Scripts/jquery-1.10.2.js
Library home page: https://cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.js
Dependency Hierarchy:
Flat UI Free is a beautiful theme for Bootstrap. We have redesigned many of its components to look flat in every pixel
path: /DEM.Net/DEM.Net.WebApi/Scripts/jquery-1.10.2.min.js
Library home page: https://cdnjs.cloudflare.com/ajax/libs/flat-ui/2.1.0/js/jquery-1.10.2.min.js
Dependency Hierarchy:
jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library ...
path: /DEM.Net/DEM.Net.WebApi/packages.config
Library home page: https://api.nuget.org/packages/jquery.1.10.2.nupkg
Dependency Hierarchy:
In v2.2.4 and previous, a lowercasing logic was used on the attribute names and was removed in v3.0.0.
Because of this, boolean attributes whose names were not all lowercase cause infinite recursion, and will exceed the stack call limit.
Publish Date: 2017-04-15
URL: WS-2017-0195
Type: Change files
Origin: jquery/jquery@d12e13d
Release Date: 2016-05-29
Fix Resolution: Replace or update the following files: attr.js, attributes.js
Step up your Open Source Security Game with WhiteSource here
Is your feature request related to a problem? Please describe.
The use-case I have is to determine if two aircraft have line of sight to each other. Each aircraft's position is defined by their Latitude, Longitude and Altitude above Mean Sea Level (MSL)
I have been messing around with the Intervisibility report and it doesn't quite support this use-case. I believe what is happening is:
Currently when you perform an intervisibility report you can pass in GeoPoints with elevation specified but that field is ignored since the LineString
used in the method only provides 2D points and then the elevation is calculated based on those points
You can optionally specify a verticalOffset from that elevation for both the source and the target in GetIntervisibilityReport
but that doesn't allow you to specify an arbitrary altitude, only an offset from the ground elevation which we do not know in advance for this use-case
Describe the solution you'd like
For this use-case all I actually need is a simple bool ElevationService.HasLineOfSight(sourcePoint, targetPoint, dataSet)
as even the Intervisibility report is overkill as all I need is the boolean "yes/no" which means we could stop the calculation the first time an obstacle is detected which may same some processing time.
However, I will assume we keep using the Intervisibility report method since it is already written and easily (I think) modified
I would like the Intervisibility report to support the elevation/altitude field in the GeoPoints passed to it.
var sourcePoint = new GeoPoint(source.Latitude, source.Longitude, source.Altitude);
var targetPoint = new GeoPoint(target.Latitude, target.Longitude, target.Altitude);
var report = ElevationService.GetIntervisibilityReport(sourcePoint, targetPoint)
And I think it could be done very easily but since this is all new to me I would like to confirm here.
In the GetIntervisibilityReport
method we need to reset the elevation of the source and target points, if they are provided, before performing the visibility calculations.
public IntervisibilityReport GetIntervisibilityReport(GeoPoint source, GeoPoint target, DEMDataSet dataSet
, bool downloadMissingFiles = true
, double sourceVerticalOffset = 0d
, double targetVerticalOffset = 0d
, InterpolationMode interpolationMode = InterpolationMode.Bilinear)
{
try
{
var elevationLine = GeometryService.ParseGeoPointAsGeometryLine(source, target);
if (downloadMissingFiles)
this.DownloadMissingFiles(dataSet, elevationLine.GetBoundingBox());
var geoPoints = this.GetLineGeometryElevation(elevationLine, dataSet);
// New code
if (source.Elevation != null)
{
geoPoints[0].Elevation = source.Elevation;
}
if (target.Elevation != null && geoPoints.Count > 1)
{
geoPoints[geoPoints.Count -1].Elevation = target.Elevation;
}
// End new code
if (dataSet.SRID != Reprojection.SRID_GEODETIC)
geoPoints = geoPoints.ReprojectTo(dataSet.SRID, Reprojection.SRID_GEODETIC).ToList();
var metrics = geoPoints.ComputeVisibilityMetrics(sourceVerticalOffset, targetVerticalOffset, dataSet.NoDataValue);
return new IntervisibilityReport(geoPoints, metrics, originVerticalOffset: sourceVerticalOffset, targetVerticalOffset: targetVerticalOffset);
}
catch (Exception ex)
{
_logger.LogError($"{nameof(GetIntervisibilityReport)} error: {ex.Message}");
throw;
}
Describe alternatives you've considered
I haven't tried it yet but looking at the code I think I could do this myself by cutting bits of code out and stitching it together myself then calling GetIntervisibilityReport(List<GeoPoint> ... )
but this seems a not-great solution since I am duplicating code in the library that could get out of sync.
One other thing to consider is that this change might not be considered backwards compatible if people are passing in GeoPoints to this method that have altitudes which are currently being ignored.
Additional context
Intervisibility report highlighting the issue where I was doing some experimenting with specifying vertical offsets etc.
var sourcePoint = new GeoPoint(source.Location.Coordinate.Latitude, source.Location.Coordinate.Longitude, source.Altitude);
var targetPoint = new GeoPoint(target.Location.Coordinate.Latitude, target.Location.Coordinate.Longitude, target.Altitude);
var report = ElevationService.GetIntervisibilityReport(sourcePoint, targetPoint, DataSet, true, source.Altitude, target.Altitude);
LOS report:
Source: E-3A 'USA air 3 unit1', Lat/Lon: 44.9440589/37.5337401 at 9138.08 meters
Target: Su-33 'RUSSIA air 21 unit1', Lat/Lon: 42.802319/41.0292858 at 2029.22 meters
Report:
Origin: Lat/Lon 44.9440589/37.5337401. elevation 458.7944641113281, vertical offset 9138.08
Target: Lat/Lon 42.802319/41.0292858. elevation 6991.50341796875, vertical offset 2029.22
Obstructed: True
Obstacles count: 552
Metrics: Min/Max: -32517.84 / 32522.96, Distance: 368135.30 m, Climb/Descent: 23523479.52 / -23516946.82
If I already have suitable geoTiff tiles of the landscape I want to work with, can I using a 2D path, and a start height and end height, get DEM.Net to create terrain across my tiles filling in the required cut/fill parts along said path?
My use case is one that I have to take a terrain with no roads, flat planes or anything, and using a set of 2D shapes of proposed road routes, flatten those road corridors through the terrain, starting at start height and interpolating to end height.
Once the road corridors are carved through the terrain, I should then be able to save the tiles back to disk with the exact same geo attributes as they had when loaded.
When a point is near the edge of a GeoTiff grid, we need the neighbors samples to get correct interpolated elevation.
JavaScript library for DOM operations
path: /DEM.Net/DEM.Net.WebApi/Scripts/jquery-1.10.2.js
Library home page: https://cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.js
Dependency Hierarchy:
jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library ...
path: /DEM.Net/DEM.Net.WebApi/packages.config
Library home page: https://api.nuget.org/packages/jquery.1.10.2.nupkg
Dependency Hierarchy:
jQuery before 3.0.0 is vulnerable to Cross-site Scripting (XSS) attacks when a cross-domain Ajax request is performed without the dataType option, causing text/javascript responses to be executed.
Publish Date: 2018-01-18
URL: CVE-2015-9251
Base Score Metrics:
Type: Change files
Origin: jquery/jquery@b078a62#diff-bee4304906ea68bebadfc11be4368419
Release Date: 2015-10-12
Fix Resolution: Replace or update the following files: script.js, ajax.js, ajax.js
Step up your Open Source Security Game with WhiteSource here
Output is at full DEM resolution. Add a parameter to support reduction (generalizing the output line)
Describe the bug
i use this code ,transform hgt to glb ,the glb file can be loaded by cesium-1.58 ,but it can not display normally,it seem to have no height.
**string str2 = "zsq4";
string str3 = @"C:\Users\sui03\Desktop\DEM.Net\DEM.Net.xUnit.Test\TestData\N43E005.hgt.zip\N43E005.hgt";
HGTFile hgtFile = new HGTFile(str3);
FileMetadata fileMetadata2= hgtFile.ParseMetaData();
HeightMap heightMap2 = hgtFile.GetHeightMap(fileMetadata2);
// ILogger <MeshService> loger=LoggerFactor
MeshService meshService = new MeshService();
glTFService gltfService = new glTFService(meshService);
MeshPrimitive meshPrimitive = gltfService.GenerateTriangleMesh(heightMap2);
Model model = gltfService.GenerateModel(meshPrimitive, str2);
gltfService.Export(model, @"c:\geotiff_gltf\", str2, false, true);**
How do I instantiate an ElevationService in 0.2.0? Previously, I did this:
class Elevation
{
DEMDataSet dataSet;
ElevationService elevationService;
public Elevation()
{
dataSet = DEMDataSet.AW3D30;
var gdal = new GDALVRTFileService();
var raster = new RasterService(gdal);
elevationService = new ElevationService(raster);
}
...
Which doesn't work anymore, and the samples I've looked at just assume I already have an IElevationService I can pass into them.
Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web developmen...
path: /DEM.Net/DEM.Net.WebApi/packages.config
Library home page: https://api.nuget.org/packages/bootstrap.3.0.0.nupkg
Dependency Hierarchy:
The most popular front-end framework for developing responsive, mobile first projects on the web.
path: /DEM.Net/DEM.Net.WebApi/Scripts/bootstrap.js
Library home page: https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.0/js/bootstrap.js
Dependency Hierarchy:
XSS in data-target in bootstrap (3.3.7 and before)
Publish Date: 2017-06-27
URL: WS-2018-0021
Type: Change files
Origin: twbs/bootstrap@d9be1da
Release Date: 2017-08-25
Fix Resolution: Replace or update the following files: alert.js, carousel.js, collapse.js, dropdown.js, modal.js
Step up your Open Source Security Game with WhiteSource here
Trying to get heightmap in bbox, using GeoTiff dataset with Cell file format, fails when bbox is partially covered.
RasterService.GetVirtualHeightMapInBBox(...) returns a hightmap half pixel shifted. This results in incorrect height map when merging tilesHeightMap in ElevationService.GetHeightMap(....)
When DEMFileRegistrationMode is Cell, we should add (metadata.pixelSizeY / 2d) to metadata.DataEndLat, and (metadata.pixelSizeX / 2d) to metadata.DataStartLon
(File:
DEM.Net/DEM.Net.Core/IO/Raster/GeoTiff.cs
Line 440 in 168cd8e
Calling ElevationService.GetIntervisibilityReport
in release [0.2.9] results in the following runtime exception
System.MissingMethodException: Method not found: 'Void NetTopologySuite.Geometries.LineString..ctor(GeoAPI.Geometries.Coordinate[])'.
at DEM.Net.Core.GeometryService.ParseGeoPointAsGeometryLine(GeoPoint[] points)
at DEM.Net.Core.ElevationService.GetIntervisibilityReport(GeoPoint source, GeoPoint target, DEMDataSet dataSet, Boolean downloadMissingFiles, Double sourceVerticalOffset, Double targetVerticalOffset, InterpolationMode interpolationMode)
I believe the issue is that the code in GeometryService
is using new Coordinate
without specifying if it is a GeoAPI
Coordinate or a NetTopologySuite
one and the code is picking the wrong one at runtime.
I believe this issue has been fixed in the master branch by the removal of GeoAPI as part of b3d755f
Is there a planned timeline for the next release of DEM.Net that contains this change?
Thanks for the great work and great library.
I know you have an intervisibility feature, but I'd be interested in a 360 degrees application of it: getting a polygon of the visible area from a specific point.
Instead of giving two points and getting the intervisibility line, we'd give one point, a radius, and get the visibility polygon: What area can be seen.
Is this something you could build? Or do you know of any project that already provides this easily?
Thanks.
I have some DEM data and I am able to follow the line elevation example however lets say I don't have a line but a single point I am trying to get the elevation for, how would I go about modifying the example to allow me to get elevation for a single point?
Hello
Great work!!!!!
can i use it offline on my xampp or ngnix server?
thank you a lot
Using ETOPO1 https://www.ngdc.noaa.gov/mgg/global/global.html
Is your feature request related to a problem? Please describe.
I just want to make sure that I am not missing something. My use-case is to have a Line-of-Sight calculation method to determine if two points (lat/lon/alt) on a WGS84 projection have line of sight between them. I am not sure if this is already possible using DEM.Net but wanted to check.
Describe the solution you'd like
A method along the lines of the following:
public bool HasLineOfSight(GeoPoint source, GeoPoint destination) {
bool result = // Lots of complicated calculations
return result
}
Ideally returns the result in less than 100ms for distances up to 100 nautical miles (assuming all tiles have been cached).
Describe alternatives you've considered
I have looked around the DEM.Net code to make sure I am not missing anything and that it is already possible without me realising it and I cannot see anything equivalent. I see there is already GeometryService.ParseGeoPointAsGeometryLine
and the like which already provides a series of heights along a line which seems like it is half the work,
I have also looked around for example code / explanations but either I am using the wrong keywords or my complete lack of GIS experience is making me unable to understand the mathematics involved in such a calculation.
Additional context
None
I'm downloading DEM files at random order. I need to know which areas are covered.
It would be great to have a bitmap showing all covered and uncovered areas with landmap behind.
Describe the bug
The elevation values of GeoPoints and Obstacles calculated in GetIntervisibilityReport
seem to be incorrect due to being incredibly high (24km tall mountains) and different from elevationapi.com results. There are also a lot of suspicious negative numbers
To Reproduce
See code @ https://gitlab.com/overlord-bot/srs-bot/-/blob/los/OverlordBot.Core/Util/LineOfSightChecker.cs
The report, including the source and target is visible @ https://gist.github.com/rurounijones/ec9160fb48a5cf86c2a5b6d8b48eb6b9
Expected behavior
Given that the source and target points are 30,000ft above mean sea level they should be visible to each other with no terrain in the way. However there are 850 obstacles (See the bottom of the gist) and a lot of the elevation values in the GeoPoints look wrong as well.
Taking one of the GeoPoints from the report:Lat/Lon 44.9170527107368/37.56388888888889 at 624.8850708007812 meters. Distance from Origin 16.142537758223373
shows an altitude of 600 meters but the same lat/lon on https://api.elevationapi.com/api/Elevation?lat=44.9170527107368&lon=37.56388888888889&dataSet=SRTM_GL1 returns 80 meters (which is accurate I believe).
It is entirely possible I have made a stupid mistake somewhere or have misunderstood something but I have double-checked everything and cannot see it.
When attempting to create a model with OSM Data I keep getting a 500 error, no matter the size of the patch, I tried multiple locations and all seem to fail so I discard the theory of a location without OSM Data. I also attempted generating only the OSM Data but with the same output.
To Reproduce
Steps to reproduce the behavior:
Desktop:
If x is from west to east and y is from north to south, then (0,0) point should be at NW, not SW
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.