Skip to content

Instantly share code, notes, and snippets.

View yzrzya1's full-sized avatar

Albert-Yu yzrzya1

View GitHub Profile
@staltz
staltz / introrx.md
Last active June 29, 2024 15:58
The introduction to Reactive Programming you've been missing
@johnpolacek
johnpolacek / .gitconfig
Last active May 8, 2024 04:05
My current .gitconfig aliases
[alias]
co = checkout
cob = checkout -b
coo = !git fetch && git checkout
br = branch
brd = branch -d
brD = branch -D
merged = branch --merged
st = status
aa = add -A .
@gaearon
gaearon / connect.js
Last active June 24, 2024 09:43
connect.js explained
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
anonymous
anonymous / 中国地图偏移算法.md
Created February 22, 2017 13:34
中国地图偏移算法

WGS-84 坐标系,是 GPS 系统所采用的坐标系。一切正常工作的 GPS 或 GPS 芯片所返回的坐标值都是这个坐标系下的数值。Google 地图采用的卫星图也是按照这个坐标系摆放的。

GCJ-02 坐标系,是我天朝政府搞出来的加密坐标系,也常常被称为“火星坐标系”。包括(但可能不限于)高德地图在内的国内地图服务商采用它来绘制地图。Apple、Google等国外公司在其道路地图中使用的也是高德的数据。BD-09 坐标系则是百度地图专用的坐标系。

在开发一些 LBS 应用时,如果不加处理,很容易出现几种形式的地图之间出现偏移的情况。因此在这几个坐标系之间进行转换非常重要。以下代码就是网络上泄露出的从 WGS-84 转 GCJ-02 的算法,以及 GCJ-02 与 BD-09 的互相转换算法。