Crates.io | jgdtrans |
lib.rs | jgdtrans |
version | |
source | src |
created_at | 2024-06-29 13:28:17.004902 |
updated_at | 2024-10-06 11:23:53.713385 |
description | Coordinate Transformer by Gridded Correction Parameter (par file) |
homepage | |
repository | https://github.com/paqira/jgdtrans-rs |
max_upload_size | |
id | 1287384 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Unofficial coordinate transformer by Gridded Correction Parameter which Geospatial Information Authority of Japan (GIAJ, formerly GSIJ) distributing for Rust.
国土地理院が公開している .par ファイルによる変換(逆変換)の非公式な実装です。
Features:
jdgtrans
requires nightly channel of Rust, it depends on a float_next_up_down
feature.
serde
: supports serialization/deserialization by serde
crate,
this requires dependency on serde
.This package does not contain parameter files, download it from GIAJ.
このパッケージはパラメータファイルを提供しません。公式サイトよりダウンロードしてください。
Sample code:
use std::error::Error;
use std::fs;
use jgdtrans::{Point, Transformer, Format};
fn main() -> Result<(), Box<dyn Error>> {
// Deserialize par-formatted file, e.g. SemiDyna2023.par
let s = fs::read_to_string("SemiDyna2023.par").expect("file not found 'SemiDyna2023.par'");
let tf = Transformer::from_str(&s, Format::SemiDynaEXE)?;
// Make the origin of transformation
let origin = Point::new_unchecked(35.0, 135.0, 2.34);
// Prints Point { latitude: 35.0, longitude: 135.0, altitude: 2.34 }
println!("{origin:?}");
// Perform forward transformation resulting a Point
let result = tf.forward(&origin)?;
// Prints Point { latitude: 34.99999831111111, longitude: 135.00000621666666, altitude: 2.33108 }
println!("{result:?}");
// Perform backward transformation
let p = tf.backward(&result)?;
// Prints Point { latitude: 35.0, longitude: 135.0, altitude: 2.34 }
println!("{p:?}");
// Perform backward transformation compatible to the GIAJ web app/APIs
let q = tf.backward_compat(&result)?;
// Prints Point { latitude: 34.999999999999986, longitude: 135.0, altitude: 2.339999999105295 }
println!("{q:?}");
Ok(())
}
MIT or Apache-2.0