Transformations
Transform coordinates between various coordinate systems used in Bulgaria.
Contents
- Info
- Install
- Ellipsoids
- Projections
- Examples
- Transform between geographic coordinates and projected in Lambert projection
- Transform between geographic coordinates and projected in UTM
- Transform between geographic coordinates and projected in Gauss–Krüger
- Transform between geographic coordinates and projected in Web Mercator
- Transform between geographic and geocentric coordinates
- Transform between BGS coordinates
- Format decimal degrees from/to degrees, minutes and seconds
- Dependencies
- Tests
- License
Info
This project is based on Transformations.NET library.
The project can be used for transforming coordinates between various coordinate systems:
- BGS 1930
- BGS 1950
- BGS Sofia
- BGS 1970 (there can be no control points near by if the point is close to the zone's border)
- BGS 2005
Following projections are available:
- Lambert Conformal Conic with 2SP
- Universal Transverse Mercator
- Gauss–Krüger
- Spherical Web Mercator
You can transform between:
- Geographic coordinates
- Projected coordinates
- Geocentric coordinates
Transformations between BGS coordinate systems are done by calculating transformation parameters using TPS or Affine transformation based on predefined control points (ControlPoints namespace). You can control what type of transformation is used by passing useTPS
boolean parameter to BGSCoordinates.transform()
. All other transformations are done directly as the transformation parameters are known. Precision is arround 10cm
.
Install
You can install it with NPM (npm install transformations
) or Yarn (yarn add transformations
) and then import a desired transformation function:
; const input = 42450682 24749747;const result = ;
Ellipsoids
;
- GRS80 - GRS 1980
- BESSEL_1841 - Bessel 1841
- CLARKE_1866 - Clarke 1866
- EVEREST - Everest (Sabah and Sarawak)
- HELMERT - Helmert 1906
- HAYFORD - Hayford
- KRASSOVSKY - Krassovsky, 1942
- WALBECK - Walbeck
- WGS72 - WGS 1972
- WGS84 - WGS 1984
- SPHERE - Normal Sphere (R=6378137)
Projections
;
- BGS_SOFIA - BGS Sofia. Local projection based on BGS 1950
- BGS_1930_24 - Gauss–Krüger projection based on Hayford ellipsoid
- BGS_1930_27 - Gauss–Krüger projection based on Hayford ellipsoid
- BGS_1950_3_24 - Gauss–Krüger projection based on Krassovsky ellipsoid
- BGS_1950_3_27 - Gauss–Krüger projection based on Krassovsky ellipsoid
- BGS_1950_6_21 - Gauss–Krüger projection based on Krassovsky ellipsoid
- BGS_1950_6_27 - Gauss–Krüger projection based on Krassovsky ellipsoid
- BGS_1970_K3 - ~ Northewest Bulgaria
- BGS_1970_K5 - ~ Southeast Bulgaria
- BGS_1970_K7 - ~ Northeast Bulgaria
- BGS_1970_K9 - ~ Southwest Bulgaria
- BGS_2005_KK - Lambert Conformal Conic with 2SP used by Cadastral Agency
- UTM34N - Universal Transverse Mercator zone 34 North
- UTM35N - Universal Transverse Mercator zone 35 North
Examples
Transform between geographic coordinates and projected in Lambert projection
; let input = 427589996 253799991;let result = ;// result is: 4735953.342, 490177.508 let input = 4735953349 490177508;let result = ;// result is: 42.7589997, 25.3799991
Transform between geographic coordinates and projected in UTM
; let input = 42450682 24749747;let result = ;// result is: 4702270.178, 314955.869 let input = 4702270179 314955869;let result = ;// result is: 42.450682, 24.749747
Transform between geographic coordinates and projected in Gauss–Krüger
; let input = 427602978166667 253824052611111;let result = ;// result is: 4736629.503, 8613154.606 let input = 4736629503 8613154607);let result = ;// result is: 42.7602978, 25.38240528
Transform between geographic coordinates and projected in Web Mercator
; let input = 42450682 24749747;let result = ;// result is: 2755129.233, 5228730.328 let input = 275512923 522873033;let result = ;// result is: 42.4506820, 24.7497470
Transform between geographic and geocentric coordinates
; let input = 42450682 24749747;let result = ;// result is: X: 4280410.654, 1973273.422, 4282674.061 let input = 4280410654 1973273422 4282674061;let result = ;// result is: 42.450682, 24.749747
Transform between BGS coordinates
- BGS 1930
; const bgs = ; let input = 4728966163 8607005227;let result = bgs;// result is: 4728401.432, 483893.508 let input = 4728401432 483893508;let result = bgs;// result is: 4728966.153, 8607005.214
- BGS 1950
; const bgs = ; let input = 4729331175 8606933614;let result = bgs;// result is: 4728401.442, 483893.521 let input = 4728401432 483893508;let result = tr;// result is: 4729331.165, 8606933.601
- BGS Sofia
; const bgs = ; let input = 48276705 45420988;let result = bgs;// result is: 4730215.221, 322402.929 let input = 4730215229 322402935;let result = bgs;// result is: 48276.713, 45420.993
- BGS 1970
; const bgs = ; let input = 4725270684 8515734475;let result = bgs;// result is: 4816275.688, 332535.346 let input = 481627568 332535401;let result = bgs;// result is: 4725270.677, 8515734.530 let input = 4613479192 9493233633;let result = bgs;// result is: 4679669.824, 569554.912 let input = 4679669825 569554918;let result = bgs;// result is: 4613479.193, 9493233.639 let input = 4708089898 9570974988;let result = bgs;// result is: 4810276.410, 626498.618 let input = 4810276431 626498611;let result = bgs;// result is: 4708089.919, 9570974.981 let input = 4547844976 8508858179;let result = bgs;// result is: 4675440.859, 330568.410 let input = 4675440847 330568434;let result = bgs;// result is: 4547844.965, 8508858.203
Transform points in extent
Use this method to calculate transformation parameters once and apply them to all input points.
You can either pass an extent, for which the transformation parameters will be calculated:
let extent = 451589116322039 847128482458501 456557962520789 855192953794741;let result = bgs;
or just pass the points and use the bounding extent:
let result = bgs;
*Use TPS transformation as it gives better accuracy.
Format decimal degrees from/to degrees, minutes and seconds
; let latitude = 42336542;let dms = ;// dms is: "422011.5512000000052" let dms = '422011.5512000000052';let result = ;// result is: 42.336542
Dependencies
Tests
Check tests for more examples.
License
transformations is MIT License @ bojko108