GithubHelp home page GithubHelp logo

gps-coordinate's Introduction

GPS坐标互转:WGS-84、GCJ-02、BD-09

WGS-84:是国际标准,GPS坐标(Google Earth使用、或者GPS模块)
GCJ-02:**坐标偏移标准,Google Map、高德、腾讯使用
BD-09:百度坐标偏移标准,Baidu Map使用

WGS-84 to GCJ-02

GPS.gcj_encrypt();
例:HTML5原声GeoLocation调用GPS获取的坐标 转换为 微信内置的地图坐标

GCJ-02 to WGS-84 粗略

GPS.gcj_decrypt();
例:微信JSSDK获取的坐标 转换为 国际GPS 

GCJ-02 to WGS-84 精确(二分极限法)

var threshold = 0.000000001;
目前设置的是精确到小数点后9位,这个值越小,越精确,但是javascript中,浮点运算本身就不太精确,九位在GPS里也偏差不大了
GSP.gcj_decrypt_exact();

GCJ-02 to BD-09

GPS.bd_encrypt();
例:微信JSSDK获取的坐标 转换为 百度地图使用的加密坐标

BD-09 to GCJ-02

GPS.bd_decrypt();
例:百度地图获取的坐标 转换为 微信内置地图的坐标 

计算两点距离

GPS.distance();

gps-coordinate's People

Contributors

zongying avatar

Watchers

James Cloos avatar Tirapong Chaiyakun avatar

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.