搜索插件、代码仓与 APP 分类

插件详情v2.1.0

dart_geohash

一个简单的经度/纬度和地理哈希的编码、解码及邻居查找工具。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
2.7万
喜欢数
52
Pub 分数
150

安装插件

flutter pub add dart_geohash

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个轻量级的 Dart 包,用于将地理坐标编码和解码为 geohash,以及查找相邻的 geohash。通过将纬度和经度对转换为紧凑的字符串表示,该包实现了高效的时空索引和邻近查询。该包支持所有主要平台,非常适合需要快速地理空间操作的应用程序,例如基于位置的服务或地图聚类。

适合场景

  • 地理空间数据索引
  • 基于位置的搜索
  • 地图聚类
  • 接近检测
  • 空间查询优化

主要特点

  • 将纬度/经度编码/解码为地理哈希
  • 查找相邻的geohash邻居
  • 高性能,开销极小
  • 跨平台兼容性
  • 简单、直观的 API

适合对象

  • 带有位置功能的移动和网页应用
  • 实时位置跟踪系统
  • 地理空间数据存储与检索
  • 需要高效空间分区的应用程序

使用建议

  • 仅限基本的geohash操作
  • 不支持复杂的空间查询
  • 需要手动处理精度级别
  • 未针对大规模地理空间数据库进行优化

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

dart_geohash

GeoHash is a simple way of storing a latitude/longitude location as a simple string.

Includes a Class for encode/decode and finding neighbors as well as a Class that can be given a location and will contain all needed information for that GeoHash.

Example

// Create a simple geohash from a given string
GeoHash myHash = GeoHash("9yf0zhhtj");
// Immediately be able to get all other information related to it
myHash.geohash;
myHash.longitude();
myHash.latitude(decimalAccuracy: 4);
myHash.neighbors; // Returns a Map with itself and 8 surrounding neighbors
myHash.neighbor(Direction.NORTH);
// You can also create it from a specific lon/lat
GeoHash myOtherHash = GeoHash.fromDecimalDegrees(-98.1235, 38.1234);
// Separately you can use only the Geohasher functions
GeoHasher geoHasher = GeoHasher();
geoHasher.encode(-98, 38); // Returns a string geohash
geoHasher.encode(-98, 38, precision: 6) // Returns string geohash with length
geoHasher.decode("9yf0zhhtj"); // Returns decimal longitude/latitude
geoHasher.neighbors("9yf0zhhtj"); // Returns itself and 8 neighbors as a Map

Based on the Python Package Mapzen GeoHash

所属分类

源码仓库

使用此插件的项目