diff options
author | Daniel Schadt <kingdread@gmx.de> | 2025-07-08 20:42:11 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2025-07-08 20:42:11 +0200 |
commit | 8d84b3315f29fffc51d91c1202a01fd0f9861f4d (patch) | |
tree | d10cc4e100eca381b802ba5aa36c30c856e58d61 | |
parent | c71c5795596c9a587cd6a422834b8891617a2403 (diff) | |
download | hittekaart-8d84b3315f29fffc51d91c1202a01fd0f9861f4d.tar.gz hittekaart-8d84b3315f29fffc51d91c1202a01fd0f9861f4d.tar.bz2 hittekaart-8d84b3315f29fffc51d91c1202a01fd0f9861f4d.zip |
add public constructor for coordinates
-rw-r--r-- | hittekaart/src/gpx.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/hittekaart/src/gpx.rs b/hittekaart/src/gpx.rs index fe7ab27..98019c3 100644 --- a/hittekaart/src/gpx.rs +++ b/hittekaart/src/gpx.rs @@ -27,6 +27,13 @@ pub struct Coordinates { } impl Coordinates { + pub fn new(longitude: f64, latitude: f64) -> Self { + Self { + longitude, + latitude, + } + } + /// Calculates the [Web Mercator /// projection](https://en.wikipedia.org/wiki/Web_Mercator_projection) of the coordinates. /// @@ -140,7 +147,8 @@ pub fn extract_from_file<P: AsRef<Path>>( brotli::BrotliDecompress( &mut BufReader::new(File::open(path).map_err(|e| Error::Io("opening file", e))?), &mut result, - ).map_err(|e| Error::Io("decompressing", e))?; + ) + .map_err(|e| Error::Io("decompressing", e))?; String::from_utf8(result)? } }; |