https://github.com/derhuerst/transform-coordinates
Transform coordinates from one coordinate system to another.
https://github.com/derhuerst/transform-coordinates
coordinates epsg geospatial gis transform
Last synced: 9 months ago
JSON representation
Transform coordinates from one coordinate system to another.
- Host: GitHub
- URL: https://github.com/derhuerst/transform-coordinates
- Owner: derhuerst
- License: isc
- Created: 2017-08-29T15:07:23.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-11-06T12:12:17.000Z (over 2 years ago)
- Last Synced: 2025-06-16T12:55:14.703Z (10 months ago)
- Topics: coordinates, epsg, geospatial, gis, transform
- Language: JavaScript
- Homepage: https://github.com/derhuerst/transform-coordinates
- Size: 10.7 KB
- Stars: 19
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# transform-coordinates
**Transform coordinates from one [coordinate system](https://en.wikipedia.org/wiki/Geographic_coordinate_system) to another.** Just a wrapper around [`proj4`](https://github.com/proj4js/proj4js) and [`epsg-index`](https://github.com/derhuerst/epsg-index).
[](https://www.npmjs.com/package/transform-coordinates)
[](https://travis-ci.org/derhuerst/transform-coordinates)


[](https://gitter.im/derhuerst)
[](https://github.com/sponsors/derhuerst)
## Installing
```shell
npm install transform-coordinates
```
## Rationale
[`proj4`](https://github.com/proj4js/proj4js) is a battle-proven tool for converting from one any coordinate system into any other. You need to specify a long and complicated string for both system though, to tell `proj4` *how* to convert.
[epsg.io](https://epsg.io/) has an index of those strings. [`epsg-index`](https://github.com/derhuerst/epsg-index) is an offline copy of them.
**This module glues together `proj4` and `epsg-index` and returns a clean API.**
## Usage
```js
const transformation = require('transform-coordinates')
const transform = transformation('EPSG:4326', '3068') // WGS 84 to Soldner Berlin
console.error(transform.forward({x: 13.4105, y: 52.5034}))
// {
// x: 25405.407133664165,
// y: 19607.826100560924,
// z: -40.94089552294463
// }
```
`transformation(from, to)` returns a [`proj4` object with `forward()` and `inverse()`](https://github.com/proj4js/proj4js#using).
## See also
- [`projections`](https://github.com/juliuste/projections) – Collection of (stereographic) map/coordinate projections.
- [`proj4`](https://github.com/proj4js/proj4js) – library to transform coordinates from one coordinate system to another
- [`epsg-index`](https://github.com/derhuerst/epsg-index) – A machine-readable index of all EPSG coordinate systems.
## Contributing
If you have a question or have difficulties using `transform-coordinates`, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to [the issues page](https://github.com/derhuerst/transform-coordinates/issues).