Feature Request: Line of Sight calculation between two GeoPoints
rurounijones opened this issue · 5 comments
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
Hi @rurounijones, thanks for posting your issue.
Yes this is possible via 'Intervisibility' methods, which already exist, albeit not well documented.
See here for live example :
https://api.elevationapi.com/api/Elevation/intervisibility?latStart=43.5&lonStart=5.2&latEnd=43.6&lonEnd=5.5&dataSet=SRTM_GL3
With Plot : (https://api.elevationapi.com/api/Elevation/intervisibility/plot?latStart=43.5&lonStart=5.2&latEnd=43.6&lonEnd=5.5&dataSet=SRTM_GL3)
- API is here :
- Unit test (with sample) is here :
DEM.Net/DEM.Net.xUnit.Test/ElevationTests.cs
Lines 134 to 145 in 945154c
Let me know if you need further assistance.
Wow that was a quick reply! I did see the "Intervisbility" bit in the project description so was hoping. I edited my comment not expecting sucha quick response but does this take into account the curvature of the earth? e.g. in a WGS84 projection?
No it does not take earth curvature into account, so this would be accurate enough for short distances.
I hope I'll get some time to fix it to enable spherical computations :)
Thank you very much for the info and examples. I will go away and give these a try.
For reference purposes: https://gitlab.com/overlord-bot/srs-bot/-/issues/30
Found a nice reference here for future implementation : http://walter.bislins.ch/bloge/index.asp?page=Advanced+Earth+Curvature+Calculator