# Coordinate conversion with the Gauss-Krüger Projection

## Overview

CoordinateConverterGK.jl is a Julia package for conversion between the Cartesian coordinates and the geographic coordinates for a point with the Gauss-Krüger Projection. The formulae are based on documents and publications of the Geospatial Information Authority of Japan (see References).

## Usage

### General use

Given a central meridian λ₀ and latitude of origin φ₀ (in degrees), Cartesian coordinates can be converted with the following code:

using CoordinateConverterGK
λ, φ = xy2lonlat(λ₀, φ₀, easting, northing)


where λ and φ are the converted longitude and latitude, easting and northing are the eastward and northward distances (in meters) from the origin, respectively. A function yx2latlon is available in the same manner:

φ, λ = yx2latlon(φ₀, λ₀, northing, easting)


Similarly, functions lonlat2xy and latlon2yx can convert geographic coordinates to Cartesian coordinates for a point.

x, y = lonlat2xy(λ₀, φ₀, λ, φ)


### Japan Plane Rectangular Coordinate System

When the Japan Plane Rectangular Coordinate System is adopted, functions such as xy2lonlat_ja and lonlat2xy_ja can omit the coordinates of origin λ₀, φ₀. These functions require the zone number of interest (1 to 19) instead.

λ, φ = xy2lonlat_ja(9, easting, northing) # in case of zone IX


## Examples

# ANSWER: lat = 36.10404755, lon = 140.08539843
julia> yx2latlon(36.0, 139.83333333, 11573.375, 22694.980)
(36.104047552508895, 140.08539842726532)

# ANSWER: y = 11543.6883, x = 22916.2436
julia> latlon2yx(36.0, 139.0+5.0/6.0, 36.103774791666666, 140.08785504166664)
(11543.688321484718, 22916.24355431881)