Skip to content

paqira/jgdtrans-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jgdtrans for Java

Maven Central Version GitHub Actions Workflow Status Static Badge GitHub License

Unofficial coordinate transformer by Gridded Correction Parameter which Geospatial Information Authority of Japan (GIAJ, formerly GSIJ) distributing for Java.

国土地理院が公開しているパラメータファイル(par ファイル)による座標変換(順逆変換)の非公式な実装です。

Features:

  • Supports offline transformation (no web API)
    • オフライン変換(web API 不使用)
  • Supports both original forward and backward transformation
    • 順変換と逆変換の両方をサポート
  • Supports verified backward transformation
    • 精度を保証した逆変換のサポート
  • Supports all TKY2JGD, PatchJGD, PatchJGD(H), HyokoRev, SemiDynaEXE and POS2JGD (geonetF3 and ITRF2014)
  • Clean implementation
    • 保守が容易な実装

Usage

jgdtrans supports Java8 and higher.

This package does not contain parameter files, download it from GIAJ.

このパッケージはパラメータファイルを提供しません。公式サイトよりダウンロードしてください。

Sample code:

import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;

import jgdtrans.*;

public class Main {
    public static void main(String[] args)
            throws IOException, CorrectionNotFoundException, ParameterNotFoundException, ParseParException {
        File file = new File("SemiDyna2023.par");
        String contents = Files.readString(file.toPath(), StandardCharsets.UTF_8);

        Transformer tf = Transformer.fromString(contents, Format.SemiDynaEXE);

        // Geospatial Information Authority of Japan
        Point origin = new Point(36.10377479, 140.087855041, 2.34);

        // forward transformation
        Point result = tf.forward(origin);
        // prints Point[latitude=36.103773017086695, longitude=140.08785924333452, altitude=2.4363138578103]
        System.out.println(result);

        // backward transformation 
        Point p = tf.backward(result);
        // prints Point[latitude=36.10377479, longitude=140.087855041, altitude=2.34]
        System.out.println(p);

        // backward transformation compatible to GIAJ web app/APIs
        Point p = tf.backwardCompat(result);
        // prints Point[latitude=36.10377479000002, longitude=140.087855041, altitude=2.339999999578243]
        System.out.println(p);
    }
}

Licence

Apache-2.0

Reference

  1. Geospatial Information Authority of Japan (GIAJ, 国土地理院): https://www.gsi.go.jp/, (English) https://www.gsi.go.jp/ENGLISH/.
  2. TKY2JGD for Windows Ver.1.3.79 (reference implementation): https://www.gsi.go.jp/sokuchikijun/tky2jgd_download.html released under 国土地理院コンテンツ利用規約 which compatible to CC BY 4.0.
  3. Other implementation: Rust https://github.com/paqira/jgdtrans-rs, Python https://github.com/paqira/jgdtrans-py, JavaScript/TypeScript https://github.com/paqira/jgdtrans-js.

About

Unofficial coordinate Transformer by GIAJ par file for Java

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages