Map projections and datum shifts in MoonBit, a port of proj4js 2.22.0
moon add t-ujiie-g/proj/// Tokyo Station in Japan's plane rectangular zone IX (EPSG:6677): about (-5995.19, -35367.23).
fn station_in_zone_9() -> (Double, Double)? {
guard @proj.Crs::from_epsg(4326) is Some(wgs84) else { return None }
guard @proj.Crs::from_epsg(6677) is Some(plane) else { return None }
@proj.transform(wgs84, plane, 139.7671, 35.6812)
}
///|
/// Lambert 93 (`+proj=lcc +lat_0=46.5 +lon_0=3 +lat_1=49 +lat_2=44 +x_0=700000 +y_0=6600000
/// +ellps=GRS80 +towgs84=0,0,0`), built by hand: angles in radians.
fn lambert93() -> @proj.Crs? {
let rad = 0.017453292519943295
let d = @proj.Definition::new(Lcc, 6378137.0, 6356752.314140356)
d.lat0 = 46.5 * rad
d.long0 = 3.0 * rad
d.lat1 = 49.0 * rad
d.lat2 = 44.0 * rad
d.x0 = 700000.0
d.y0 = 6600000.0
d.towgs84 = [0.0, 0.0, 0.0]
@proj.Crs::new(d)
}pub struct Crs {
// private fields
}pub(all) struct Definition {
proj : Method
a : Double
b : Double
r_a : Bool
towgs84 : Array[Double]
datum_wgs84 : Bool
to_meter : Double
from_greenwich : Double
long_wrap : Double
lat0 : Double
lat1 : Double
lat2 : Double
lat_ts : Double
long0 : Double
long1 : Double
long2 : Double
alpha : Double
gamma : Double
longc : Double
x0 : Double
y0 : Double
k0 : Double
zone : Int
south : Bool
no_uoff : Bool
no_rot : Bool
czech : Bool
}pub(all) enum Method {
LongLat
Merc
Tmerc
Utm
Lcc
Aea
Aeqd
Stere
Sterea
Cass
Laea
Eqc
Eqdc
Sinu
Eck6
Moll
Robin
Cea
Mill
Poly
Omerc
Somerc
Krovak
Ortho
Gnom
Eqearth
Bonne
}let DEFINITION_SLOTS : IntInstall
Download zipMap projections and datum shifts in MoonBit, a port of proj4js 2.22.0