Giter VIP home page Giter VIP logo

transform-coordinates's Introduction

transform-coordinates

Transform coordinates from one coordinate system to another. Just a wrapper around proj4 and epsg-index.

npm version build status ISC-licensed minimum Node.js version chat with me on Gitter support me via GitHub Sponsors

Installing

npm install transform-coordinates

Rationale

proj4 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 has an index of those strings. epsg-index is an offline copy of them.

This module glues together proj4 and epsg-index and returns a clean API.

Usage

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().

See also

  • projections – Collection of (stereographic) map/coordinate projections.
  • proj4 – library to transform coordinates from one coordinate system to another
  • 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.

transform-coordinates's People

Contributors

derhuerst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

transform-coordinates's Issues

Uncaught TypeError: proj4 is not a function

Hi, trying to use this package in browser and i get the following error:
Uncaught TypeError: proj4 is not a function

Bundling is done by ParcelJS.
Tried both with import and require(), same result.
How can i make it work?

No luck with the suggestion i found const proj4 = require("proj4").default
since i'm not directly calling proj4() - just as in the example from Readme file.

Thank you in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.