Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use GSI's geoid model of Japan (GSIGEO2011) in Rust, Python and JavaScript — 国土地理院の日本のジオイドモデルを用いてジオイド高を計算する Rust、Python、JavaScript 用ライブラリ

License

Notifications You must be signed in to change notification settings

ciscorn/japan-geoid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

japan-geoid

Test Maturin codecov Crates.io Version PyPI - Version NPM Version

A library for calculating geoid heights in Japan using GSI's geoid model. It is implemented in Rust and additionally supports Python and JavaScript.

日本のジオイド高を計算するためライブラリです。Rust で実装されており、Python と JavaScript (Wasm) でも利用できます。国土地理院のジオイドモデルを用いて、国土地理院による C++ のサンプルコードに準拠した補間計算を行います。

Supported Models

Model Function Description
GSIGEO2011 load_embedded_gsigeo2011 日本のジオイド2011 v.2.2
JPGEO2024 load_embedded_jpgeo2024 ジオイド2024 (JGD2024用、海域含む大容量)
Hrefconv2024 load_embedded_hrefconv2024 基準面補正パラメータ2024 (離島用)
JPGEO2024+Hrefconv2024 load_embedded_jpgeo2024_hrefconv2024 JPGEO2024+Hrefconv2024 合成版(陸域のみのため小容量)

測量法に基づく国土地理院長承認(使用)R 5JHs 560

License: MIT

本ライブラリは、国土地理院が提供するものではありません。

Python

Installation

pip install japan-geoid -U

Usage

from japan_geoid import (
    load_embedded_gsigeo2011,
    load_embedded_jpgeo2024,
    load_embedded_jpgeo2024_hrefconv2024,
)

# Load the embedded geoid model.
geoid = load_embedded_jpgeo2024_hrefconv2024()

# Calculate the geoid height.
(lng, lat) = (138.2839817085188, 37.12378643088312)
height = geoid.get_height(lng, lat)
print(f"{lng=} {lat=} {height=}")

# Returns NaN if the input is outside the domain.
geoid.get_height(10.0, 10.0) # => nan

# The library also works with Numpy.
import numpy as np
geoid.get_heights(
    np.array([138.2839817085188, 141.36199967724426]),
    np.array([37.12378643088312, 43.06539278249951]),
)

Rust

Installation

If you want to use the JPGEO2024+Hrefconv2024 model:

cargo add japan-geoid -F jpgeo2024_hrefconv2024

Usage

use japan_geoid::gsi::load_embedded_jpgeo2024_hrefconv2024;
use japan_geoid::Geoid;

fn main() {
    // Load the embedded geoid model.
    let geoid = load_embedded_jpgeo2024_hrefconv2024();

    // Calculate the geoid height.
    let (lng, lat) = (138.2839817085188, 37.12378643088312);
    let height = geoid.get_height(lng, lat);
    println!("Input: (lng: {lng}, lat: {lat}) -> Geoid height: {height}");

    // Returns NaN if the input is outside the domain.
    assert!(f64::is_nan(geoid.get_height(10.0, 10.0)))
}

JavaScript (Wasm) - Experimental

Installation

npm install japan-geoid

Usage

import init, {
  loadEmbeddedGSIGEO2011,
  loadEmbeddedJPGEO2024,
  loadEmbeddedJPGEO2024Hrefconv2024,
} from "japan-geoid";

await init(); // load .wasm

const geoid = loadEmbeddedJPGEO2024Hrefconv2024();

console.log(
  geoid.getHeight(138.2839817085188, 37.12378643088312)
); // => 39.56593692999162

console.log(
  geoid.getHeights(
    new Float64Array([138.2839817085188, 141.36199967724426]),
    new Float64Array([37.12378643088312, 43.06539278249951])
  )
); // => Float64Array(2) [ 39.56593692999162, 31.98825817633539 ]

Build

wasm-pack build -t web --all-features

Golang

See: https://github.com/eukarya-inc/japan-geoid-go

License

MIT License

Authors

About

Use GSI's geoid model of Japan (GSIGEO2011) in Rust, Python and JavaScript — 国土地理院の日本のジオイドモデルを用いてジオイド高を計算する Rust、Python、JavaScript 用ライブラリ

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •