stronnag/mwptools

[Feature Request] Support local DEMs for Terrain and Line of sight

stronnag opened this issue · 2 comments

Requirement

It would be nice if mwp could use local DEMs in order to speed up terrain / LOS analysis and remove the requirement for a user BING API key.

Advantages

  • Speed up establishment of elevations for mission planning
  • Speed up terrain / LOS analysis
  • Remove need for user Bing API key
  • Allow offline elevation analysis (if the required DEMs are locally available)

Disadvantages

  • Need to download DEMs to local storage
  • This takes longer than a trivial Bing download

Proposed Solution

  • Provide automated download of the Mapzen DEM SRTM (Shuttle Radar Telemetry Mission) HGT files. No user intervention is needed.
  • Uses the downloaded HGT files for all mwp elevation requirements.

Example speedup

Experiment with locally hosted (file system) MapZen DEM (*.hgt) files v BING Rest API.

  • 46 mission points
  • 593 path terrain analysis points

Local DEM

2023/11/12 20:38:41 Local elev 46 took 157.676µs
2023/11/12 20:38:41 Local elev 593 took 1.853239ms

Bing DEM

2023/11/12 20:38:06 Bing elev 46 took 238.73595ms
2023/11/12 20:38:08 Bing elev 593 took 2.211965854s

i.e. local DEM is about 100 times faster. Note, I have a somewhat slow rural internet, even so, the speed up is nice.

Storage requirement

Local storage is quite small for most users. DEM files cover 1° x 1°, so a single file may suffice for most users. Each file is 25MB, for example:

-rw-r--r-- 1 jrh jrh 25934402 Nov 12 13:48 N37W123.hgt
-rw-r--r-- 1 jrh jrh 25934402 Nov 13 13:40 N51E007.hgt
-rw-r--r-- 1 jrh jrh 25934402 Nov 13 21:05 N54W005.hgt
-rw-r--r-- 1 jrh jrh 25934402 Nov 14 13:28 S39E175.hgt

Testing Opportunity

  • Use the development branch
  • Verify that elevation related functions work

Using local DEMs is now the default. The DEMs are stored in ~/.cache/mwp/DEMs/ which is created on demand.

In dev branch.