proximity_hash 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 73

Dart Proximity Hash #

Pub Version

Proximity Hash generates a set of geohashes that cover a circular area, given the center coordinates and the radius. Geohash is a public domain geocode system which encodes a geographic location into a short string of letters and digits and is used as unique identifies and to represent point data in databases.

For example the point

25.6953° S, 54.4367° W

will covert to

6g3mc626.

Install #

To get this plugin, add proximity_hash as a dependency in your pubspec.yaml file. For example:

dependencies:
  proximity_hash: ^1.0.0

Usage #

To get all the geohashes within a radius of 5000 meters from the point 25.6953° S, 54.4367 with precision 3 simply import the library and call createGeohashes(). The precision dictates how long and how many geohashes are returned.

import 'package:proximity_hash/proximity_hash.dart';

List<String> proximityGeohashes = createGeohashes(48.864716, 2.349014, 5000, 3);    

Issues #

Please file any issues, bugs or feature requests as an issue on our GitHub page.

Want to contribute #

If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature) submit a pull request.


Based on https://github.com/ashwin711/proximityhash

[1.0.1] #

  • Removed dependency on flutter

[1.0.0] #

  • Initial release

example/main.dart

import 'package:proximity_hash/proximity_hash.dart';

// get all points within a certain radius

//points
void main() { 

  List<List<double>> points = [[48.864716,	2.349014],[48.864716,	3.349014],[58.864716,	2.349014]];

  //get geohashes within 5000 meter
  List<String> proximityGeohashes = createGeohashes(48.864716, 2.349014, 5000, 3);    
  for(var g in points) {
    if (proximityGeohashes.contains(convertToGeohash(0.0,0.0,g[0],g[1],3))){
      print('The coordinates ${g[0].toString()},${g[1].toString()} are within 5000 meters of 48.864716, 2.349014');
    }
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  proximity_hash: ^1.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:proximity_hash/proximity_hash.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
47
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
73
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14

Health issues and suggestions

Document public APIs. (-1 points)

6 out of 6 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/proximity_hash.dart.

Run dartfmt to format lib/proximity_hash.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
dart_geohash ^1.0.2 1.0.2
Dev dependencies
test ^1.2.0