Node-Geohash 技术文档
1. 安装指南
安装方式
Node-Geohash 是一个用于 Node.js 的 Geohash 库。你可以通过 npm 来安装这个库。
npm install ngeohash
2. 项目使用说明
基本用法
安装完成后,你可以在你的 Node.js 项目中引入 ngeohash
模块,并使用其提供的功能。
var geohash = require('ngeohash');
// 编码经纬度为 Geohash 字符串
console.log(geohash.encode(37.8324, 112.5584));
// 输出: ww8p1r4t8
// 解码 Geohash 字符串为经纬度
var latlon = geohash.decode('ww8p1r4t8');
console.log(latlon.latitude); // 输出: 37.8324
console.log(latlon.longitude); // 输出: 112.5584
基本方法
geohash.encode(latitude, longitude, precision=9)
将一对经纬度值编码为 Geohash 字符串。第三个参数是可选的,用于指定 Geohash 字符串的长度,从而影响其精度。
geohash.decode(hashstring)
将 Geohash 字符串解码为经纬度值。返回一个包含 latitude
和 longitude
键的 JavaScript 对象。
geohash.decode_bbox(hashstring)
将 Geohash 字符串解码为匹配的边界框。返回一个四元素数组:[minlat, minlon, maxlat, maxlon]
。
geohash.bboxes(minlat, minlon, maxlat, maxlon, precision=9)
获取 [minlat, minlon]
和 [maxlat, maxlon]
之间的所有 Geohash 字符串。这些字符串可以用于在缓存中查找 POI。
geohash.neighbor(hashstring, direction)
在指定方向上查找 Geohash 字符串的邻居。方向是一个二维数组,例如 [1,0]
表示北,[-1,-1]
表示西南。
geohash.neighbors(hashstring)
查找 Geohash 字符串的所有 8 个邻居 [n, ne, e, se, s, sw, w, nw]
。
整数方法
geohash.encode_int(latitude, longitude, bitDepth=52)
将一对经纬度值编码为 Geohash 整数。第三个参数是可选的,用于指定整数的 bitDepth
,从而影响其精度。
geohash.decode_int(hashinteger, bitDepth=52)
将 Geohash 整数解码为经纬度值。返回一个包含 latitude
和 longitude
键的 JavaScript 对象。
geohash.decode_bbox_int(hashinteger, bitDepth=52)
将 Geohash 整数解码为匹配的边界框。返回一个四元素数组:[minlat, minlon, maxlat, maxlon]
。
geohash.bboxes_int(minlat, minlon, maxlat, maxlon, bitDepth=52)
获取 [minlat, minlon]
和 [maxlat, maxlon]
之间的所有 Geohash 整数。
geohash.neighbor_int(hashinteger, direction, bitDepth=52)
在指定方向上查找 Geohash 整数的邻居。
geohash.neighbors_int(hashinteger, bitDepth=52)
查找 Geohash 整数的所有 8 个邻居 [n, ne, e, se, s, sw, w, nw]
。
3. 项目 API 使用文档
编码与解码
geohash.encode(latitude, longitude, precision=9)
:将经纬度编码为 Geohash 字符串。geohash.decode(hashstring)
:将 Geohash 字符串解码为经纬度。
边界框
geohash.decode_bbox(hashstring)
:解码 Geohash 字符串为边界框。geohash.bboxes(minlat, minlon, maxlat, maxlon, precision=9)
:获取指定范围内的所有 Geohash 字符串。
邻居
geohash.neighbor(hashstring, direction)
:查找指定方向的邻居。geohash.neighbors(hashstring)
:查找所有 8 个邻居。
整数编码与解码
geohash.encode_int(latitude, longitude, bitDepth=52)
:将经纬度编码为 Geohash 整数。geohash.decode_int(hashinteger, bitDepth=52)
:将 Geohash 整数解码为经纬度。
整数边界框
geohash.decode_bbox_int(hashinteger, bitDepth=52)
:解码 Geohash 整数为边界框。geohash.bboxes_int(minlat, minlon, maxlat, maxlon, bitDepth=52)
:获取指定范围内的所有 Geohash 整数。
整数邻居
geohash.neighbor_int(hashinteger, direction, bitDepth=52)
:查找指定方向的邻居。geohash.neighbors_int(hashinteger, bitDepth=52)
:查找所有 8 个邻居。
4. 项目安装方式
Node-Geohash 可以通过 npm 进行安装:
npm install ngeohash
安装完成后,你可以在项目中通过 require('ngeohash')
引入并使用该库。
HunyuanImage-3.0
HunyuanImage-3.0 统一多模态理解与生成,基于自回归框架,实现文本生成图像,性能媲美或超越领先闭源模型00- DDeepSeek-V3.2-ExpDeepSeek-V3.2-Exp是DeepSeek推出的实验性模型,基于V3.1-Terminus架构,创新引入DeepSeek Sparse Attention稀疏注意力机制,在保持模型输出质量的同时,大幅提升长文本场景下的训练与推理效率。该模型在MMLU-Pro、GPQA-Diamond等多领域公开基准测试中表现与V3.1-Terminus相当,支持HuggingFace、SGLang、vLLM等多种本地运行方式,开源内核设计便于研究,采用MIT许可证。【此简介由AI生成】Python00
GitCode-文心大模型-智源研究院AI应用开发大赛
GitCode&文心大模型&智源研究院强强联合,发起的AI应用开发大赛;总奖池8W,单人最高可得价值3W奖励。快来参加吧~0370Hunyuan3D-Part
腾讯混元3D-Part00ops-transformer
本项目是CANN提供的transformer类大模型算子库,实现网络在NPU上加速计算。C++099AI内容魔方
AI内容专区,汇集全球AI开源项目,集结模块、可组合的内容,致力于分享、交流。02Spark-Chemistry-X1-13B
科大讯飞星火化学-X1-13B (iFLYTEK Spark Chemistry-X1-13B) 是一款专为化学领域优化的大语言模型。它由星火-X1 (Spark-X1) 基础模型微调而来,在化学知识问答、分子性质预测、化学名称转换和科学推理方面展现出强大的能力,同时保持了强大的通用语言理解与生成能力。Python00GOT-OCR-2.0-hf
阶跃星辰StepFun推出的GOT-OCR-2.0-hf是一款强大的多语言OCR开源模型,支持从普通文档到复杂场景的文字识别。它能精准处理表格、图表、数学公式、几何图形甚至乐谱等特殊内容,输出结果可通过第三方工具渲染成多种格式。模型支持1024×1024高分辨率输入,具备多页批量处理、动态分块识别和交互式区域选择等创新功能,用户可通过坐标或颜色指定识别区域。基于Apache 2.0协议开源,提供Hugging Face演示和完整代码,适用于学术研究到工业应用的广泛场景,为OCR领域带来突破性解决方案。00- HHowToCook程序员在家做饭方法指南。Programmer's guide about how to cook at home (Chinese only).Dockerfile09
- PpathwayPathway is an open framework for high-throughput and low-latency real-time data processing.Python00
项目优选









