Skip to content

🌎 坐标转换工具,提供WGS84,GCJ02,百度坐标系的相互转换。

License

Notifications You must be signed in to change notification settings

BNDong/coordtransform-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to coordtransform-php 👋

提供百度坐标系(bd-09)、火星坐标系(国测局坐标系、gcj02)、WGS84坐标系的相互转换,基于 PHP 语言,无特殊依赖。
本库代码为 wandergis/coordtransform 的 PHP 版,并根据 ipcjs/coordtransform 做了国内区域判断逻辑的优化。

JavaScript version:https://github.com/wandergis/coordtransform

Python version:https://github.com/wandergis/coordTransform_py

Cli version:https://github.com/wandergis/coordtransform-cli

Go version:https://github.com/qichengzx/coordtransform

Java version:https://github.com/ipcjs/coordtransform

Example

require_once 'coordtransform.php';

Coordtransform::gcj02ToBd09($lng, $lat);
Coordtransform::gcj02ToWgs84($lng, $lat);
Coordtransform::wgs84ToGcj02($lng, $lat);
Coordtransform::wgs84ToBd09($lng, $lat);
Coordtransform::bd09ToGcj02($lng, $lat);
Coordtransform::bd09ToWgs84($lng, $lat);

Test

PHP:

array (size=2)
    0 => float 101.66758917038
    1 => float 34.446565679398

array (size=2)
    0 => float 101.6593935994
    1 => float 34.44201870302

array (size=2)
    0 => float 101.6628764006
    1 => float 34.43883929698

array (size=2)
    0 => float 101.66933760126
    1 => float 34.444950045745

array (size=2)
    0 => float 101.65471487632
    1 => float 34.434211121566

array (size=2)
    0 => float 101.65298716899
    1 => float 34.435816401314

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Javascript: 

(2) [101.66758917038334, 34.446565679397786]
(2) [101.65939359940022, 34.442018703020054]
(2) [101.66287640059979, 34.43883929697995]
(2) [101.66933760125637, 34.44495004574466]
(2) [101.65471487632013, 34.434211121566484]
(2) [101.65298716898793, 34.43581640131362]

Show your support

Give a ⭐️ if this project helped you!

About

🌎 坐标转换工具,提供WGS84,GCJ02,百度坐标系的相互转换。

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages