#japan #model #gsi #heights #javascript #embedded #wasm #gis #geoid

japan-geoid

Calculates geoid heights for Japan using GSI's geoid model

4 releases

0.6.0 Dec 8, 2025
0.4.4 Mar 10, 2025
0.4.1 Aug 14, 2024
0.4.0 Jan 21, 2024
0.2.1 Jan 19, 2024

#75 in Geospatial

Download history 38/week @ 2025-10-22 36/week @ 2025-10-29 36/week @ 2025-11-05 43/week @ 2025-11-12 30/week @ 2025-11-19 56/week @ 2025-11-26 73/week @ 2025-12-03 1/week @ 2025-12-10 18/week @ 2025-12-17 14/week @ 2025-12-24 1/week @ 2025-12-31 13/week @ 2026-01-07 11/week @ 2026-01-14 24/week @ 2026-01-21 54/week @ 2026-01-28 82/week @ 2026-02-04

175 downloads per month

MIT license

5.5MB
712 lines

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

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

License

MIT License

Authors

Dependencies