Skip to content

Commit 2767d46

Browse files
authored
"japan-geoid" crate の変更に追従する (#192)
[MIERUNE/japan-geoid] の変更に追従するだけの修正を行います。 (mainがビルドできなくなっているため、特例的にレビューなしでマージします)。
1 parent 0ebc286 commit 2767d46

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

nusamai-projection/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ edition = "2021"
55

66
[dependencies]
77
japan-geoid = { git = "https://github.com/MIERUNE/japan-geoid" }
8-
lz4_flex = "0.11.1"
98
thiserror = "1.0.50"
-671 KB
Binary file not shown.

nusamai-projection/src/vshift.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use japan_geoid::{Geoid, MemoryGrid};
1+
use japan_geoid::gsi::MemoryGrid;
2+
use japan_geoid::Geoid;
23

34
/// Convert from JGD 2011 Geograhpic 3D (EPSG:6697) to WGS84 Geograhpic 3D (EPSG:4979)
45
pub struct JGD2011ToWGS84 {
@@ -7,13 +8,9 @@ pub struct JGD2011ToWGS84 {
78

89
impl JGD2011ToWGS84 {
910
/// Create a new instance with the embed geoid model data.
10-
pub fn from_embedded_model() -> Self {
11-
const EMBEDDED_MODEL: &[u8] = include_bytes!("../examples/data/gsigeo2011_ver2_2.bin.lz4");
12-
let decompressed = &lz4_flex::decompress_size_prepended(EMBEDDED_MODEL).unwrap();
13-
let mut reader = std::io::Cursor::new(decompressed);
14-
11+
pub fn new() -> Self {
1512
Self {
16-
geoid: MemoryGrid::from_binary_reader(&mut reader).unwrap(),
13+
geoid: japan_geoid::gsi::load_embedded_gsigeo2011(),
1714
}
1815
}
1916

@@ -24,14 +21,20 @@ impl JGD2011ToWGS84 {
2421
}
2522
}
2623

24+
impl Default for JGD2011ToWGS84 {
25+
fn default() -> Self {
26+
Self::new()
27+
}
28+
}
29+
2730
#[cfg(test)]
2831
mod tests {
2932
use super::*;
3033

3134
#[test]
3235
fn fixtures() {
3336
let (lng_jgd, lat_jgd, elevation) = (138.2839817085188, 37.12378643088312, 0.);
34-
let jgd_to_wgs = JGD2011ToWGS84::from_embedded_model();
37+
let jgd_to_wgs = JGD2011ToWGS84::new();
3538
let (lng_wgs, lat_wgs, ellips_height) = jgd_to_wgs.convert(lng_jgd, lat_jgd, elevation);
3639
assert!((ellips_height - 39.47387115961899).abs() < 1e-8);
3740
// (lng, lat) must not change.

0 commit comments

Comments
 (0)