https://github.com/perliedman/local-proj
Find a suitable local projection from GeoJSON data
https://github.com/perliedman/local-proj
Last synced: over 1 year ago
JSON representation
Find a suitable local projection from GeoJSON data
- Host: GitHub
- URL: https://github.com/perliedman/local-proj
- Owner: perliedman
- License: isc
- Created: 2015-09-28T07:11:38.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2017-04-05T19:17:37.000Z (over 9 years ago)
- Last Synced: 2024-04-26T07:22:53.169Z (about 2 years ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# local-proj
[](https://badge.fury.io/js/local-proj) [](https://travis-ci.org/perliedman/local-proj)
Find a projection for easy cartesian calculations, given a GeoJSON in WGS84.
_Problem:_ you have geographic data in WGS84 of limited extent, but arbitrary location,
and you need to work with the data in a cartesian system (use euclidean distance, etc.)
_Solution:_ feed your data to `local-proj`, and it will hand you a suitable projection
independent of geographic location
## Installing
```
npm install --save local-proj
```
## Example
```javascript
var localProj = require('local-proj');
var geojson = [...]
var projection = localProj.find(geojson);
var cartesian = projection.forward(geojsoncoord);
```
To reproject your GeoJSON to the projection, you might want to look at
[reproject](https://github.com/perliedman/reproject).
## API
### find(geojson)
Finds a local projection that is suitable for projecting the `geojson` to cartesian
coordinates.
The returned projection is a [proj4](http://proj4js.org/) projection object (`proj4.Proj`), which
you can use to create transforms to and from other projections.
Note that the local coordinate system will only work as expected for datasets up to a couple
of hundred kilometers in size.
Currently, the returned projection will always be a [transverse mercator](https://en.wikipedia.org/wiki/Transverse_Mercator_projection) projection.