稳态 Z 曲线
安装使用
const z = ; z; z;
在浏览器中测试: https://npm.runkit.com/z-curve
API
encode(latitude, longitude, scala = 0)
Encode a pair of latitude and longitude values into a z-curve.
const z = ; z === 471947;
decode(z_value)
Decode a hash string into pair of latitude and longitude values. A javascript object is returned with lat
and lng
keys.
const z = ; z;// {// lat: 32.16796875,// lng: 118.65234375// }
参考资料
- GeoHash Node 实现: https://github.com/sunng87/node-geohash