rdnaptrans.js
JavaScript implementation of RDNAPTRANS™ https://www.kadaster.nl/web/Themas/Registraties/Rijksdriehoeksmeting/Transformatie-van-coordinaten.htm
For Node.js back end and browser front end.
Install:
Generic
- clone the repo
- run
npm install
Node.js
npm install --save rdnaptrans
Browser
Use the bundled version under /dist.
Usage:
The phi
, lambda
and h
stuff in the returned Geographic object correspond with latitude, longitude and height. Due to the port, the implementation is still very close to the original Java version. Therefore, you need a few helping classes to convert from RD or ETRS89.
Node.js
const Transform = require('rdnaptrans').Transform;
const Geographic = require('rdnaptrans').Geographic;
const Cartesian = require('rdnaptrans').Cartesian;
const texelRD = new Cartesian(117380.1200, 575040.3400, 1.0000);
const texelETRS = Transform.rdnap2etrs(texelRD);
console.log(texelETRS);
/* output:
Geographic {
phi: 53.16075304177141,
lambda: 4.824761912426986,
h: 42.86140355819888 }
*/
Testing
The module is built and tested for Node on Travis. However, you can run the tests yourself simply by using grunt webpack
and npm test
. grunt is installed through npm install -g grunt grunt-cli
.
Future
TODO:
- Create geoJSON convenience functions
- Create toFixed() convenience functions
- Create convenience properties or functions for lat, lon, z on Geographic class
- Expand examples