dted2: DTED reader for Rust

  Refactored outdated DTED crate to be more performant and easier to use


  Personal Project — Status: Complete / Maintained

  May 2024Columbia, Maryland

Repositories

   — dted2

https://crates.io/crates/dted2

Overview

DTED is a format for storing elevation data. There existed a crate called dted, which was last updated 3 years ago. Usually with “outdated” Rust-projects, they still work fine, but they were using an outdated dependency of nom, which has since added optimizations in parsing times. This was simply done to update to the most recent version of nom.

There are some incomplete features of this crate, which don’t explicitly adhere to the DTED standard. I have no intention on updating them simply due to time, but am open to PR’s to implement them.

Note that I have since learned of the combinator parser library called winnow, which is a 0-copy parser and significantly more intuitive to use than nom, and I would like to some day migrate to that. For the time being, this will do.

README example

use dted2::{ DTEDData, DTEDMetadata };

let data = DTEDData::read("dted_file.dt2").unwrap();
let metadata: DTEDMetadata = data.metadata;
// or can read just the header without the rest of the data
let metadata: DTEDMetadata = DTEDData::read_header("dted_file.dt2").unwrap();

// query elevation, returns None if out of bounds
let elevation: f64 = data.get_elevation(50.0, 10.0).unwrap();