Socket
Socket
Sign inDemoInstall

local-coordinate-transform

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

local-coordinate-transform

transform local coordinates to wgs84 or vice versa


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Local Coordinate Transform

NPM Version CircleCI

A lib based on least square to convert 2d coordinate to wgs84 coordinate and vice versa.

一个基于最小二乘法,互相转化wgs坐标与二维本地坐标的js库.

Usage

npm

npm i local-coordinate-transform --save
import lct from 'local-coordinate-transform';

//sample control points
//控制点样本数据
const localSamples = [ [ -8797.705978459271, -8993.371382255224 ],
[ -8283.305160346732, -8505.738585286075 ],
[ -6943.737953213451, -8126.486025049468 ],
[ -6359.556882573757, -8643.883626252704 ],
[ -7328.668372900924, -9012.36640388437 ],
[ -7586.993911318015, -8887.387559140858 ],
[ -8540.888023241656, -8977.154924226576 ],
[ -8046.942813511472, -8886.475888854417 ],
[ -8415.071092087135, -9500.933204580506 ],
[ -7961.222764147446, -9289.597782096651 ] ];

const wgs84Samples = [ [ 121.37488150121452, 31.15430386446369 ],
[ 121.38027245297057, 31.158705639773533 ],
[ 121.39431945643642, 31.16213467320355 ],
[ 121.40044976841277, 31.157471270229813 ],
[ 121.39028834317925, 31.154142336752663 ],
[ 121.38757821744674, 31.155267977543215 ],
[ 121.3775747764141, 31.154451971945033 ],
[ 121.38275439214293, 31.1552732299672 ],
[ 121.37889854203316, 31.14972870761177 ],
[ 121.38365648516356, 31.15163789378666 ] ];

const transform = lct(localSamples, wgs84Samples);
//第一个参数是用来接收结果的数组,第二个参数是84坐标值
const local = transform.toLocal([],[ 121.38365648516356, 31.15163789378666 ]);
//第一个参数是用来接收结果的数组,第二个参数是本地坐标值
const wgs84 = transform.fromLocal([],[ -7961.222764147446, -9289.597782096651 ]);

Browser

<script src="https://cdn.jsdelivr.net/npm/local-coordinate-transform/dist/local-coordinate-transform.js"></script>

<script>
const transform = lct(localSamples, wgs84Samples);
</script>

FAQs

Package last updated on 14 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc