Search packages, repositories and app categories

Package detailsv2.1.0

dart_geohash

A simple encode, decode, and neighbor finder for longitude/latitude and geohash.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
26.9K
Likes
52
Pub points
150

Install package

flutter pub add dart_geohash

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A lightweight Dart package for encoding and decoding geographic coordinates into geohashes, as well as finding neighboring geohashes. It enables efficient spatial indexing and proximity queries by converting latitude and longitude pairs into compact string representations. The package supports all major platforms and is ideal for applications requiring fast geospatial operations like location-based services or map clustering.

Use cases

  • Geospatial data indexing
  • Location-based search
  • Map clustering
  • Proximity detection
  • Spatial query optimization

Key features

  • Encode/decode latitude/longitude to geohash
  • Find adjacent geohash neighbors
  • High performance with minimal overhead
  • Cross-platform compatibility
  • Simple, intuitive API

Suitable for

  • Mobile and web apps with location features
  • Real-time location tracking systems
  • Geospatial data storage and retrieval
  • Applications needing efficient spatial partitioning

Considerations

  • Limited to basic geohash operations
  • No built-in support for complex spatial queries
  • Requires manual handling of precision levels
  • Not optimized for large-scale geospatial databases

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

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

Categories

Source repository

Projects using this package