ptolemy-reproject
Reproject between coordinates systems. Supports EPSG codes.
This project is based on proj4js and PostGIS Spatial Reference table.
It can be used for who needs to deal with more projections than the common web projections (EPSG:4326, EPSG:3857).
Setup
npm install ptolemy-reproject
Coordinate Reference System Options
You can use the EPSG code number, WKT or proj4 string to convert the projections.
Functions
point
const ptolemyReproject = ; //ptolemyReproject.point(sourceCRS, toCRS, pointCoordinate);const result = ptolemyReproject;console;// [ 332629.00686995825, 7392387.8835482355 ]
multipoint
const ptolemyReproject = ; //ptolemyReproject.multipoint(sourceCRS, toCRS, multipointCoordinate);const result = ptolemyReproject;console;// [ [ 332629.00686995825, 7392387.8835482355 ], [ 226053.02820297563, 7645646.386169953 ] ]
linestring
const ptolemyReproject = ; //ptolemyReproject.linestring(sourceCRS, toCRS, linestringCoordinate);const result = ptolemyReproject;console;// [ [ 331991.4287047193, 7392429.793622222 ],// [ 332060.80596672115, 7392373.411801645 ],// [ 332071.60244720604, 7392363.189180976 ] ]
multilinestring
const ptolemyReproject = ; //ptolemyReproject.multilinestring(sourceCRS, toCRS, multilinestringCoordinate);const result = ptolemyReproject;console;// [ [ [ 331991.4287047193, 7392429.793622222 ],// [ 332060.80596672115, 7392373.411801645 ] ],// [ [ 332060.80596672115, 7392373.411801645 ],// [ 332071.60244720604, 7392363.189180976 ] ] ]
polygon
const ptolemyReproject = ; //ptolemyReproject.polygon(sourceCRS, toCRS, polygonCoordinate);const result = ptolemyReproject;console;// [ [ [ 523823.74799737247, 7663378.812094709 ],// [ 507567.6962134191, 7664244.906816781 ],// [ 516971.61788843677, 7656300.323619341 ],// [ 523823.74799737247, 7663378.812094709 ] ] ]
multipolygon
const ptolemyReproject = ; //ptolemyReproject.multipolygon(sourceCRS, toCRS, multipolygonCoordinate);const result = ptolemyReproject;console;// [[[// [523823.74799737247, 7663378.812094709],// [507567.6962134191, 7664244.906816781],// [516971.61788843677, 7656300.323619341],// [523823.74799737247, 7663378.812094709]]],// [[// [500718.3570432642, 7570375.557733057],// [482862.1996588615, 7562756.012907166],// [497317.38720489846, 7559947.418020568],// [500718.3570432642, 7570375.557733057],// ]]];
Testing
npm test