Giter Site home page Giter Site logo

proximityhash's Introduction

ProximityPyHash: Geohashes in Proximity

Code Health PyPI version PyPI

This is a fork of ProximityHash which improved the setup and changed the dependency towards calculating geohash to pygeohash instead of geohash.

Geohash is a geocoding system invented by Gustavo Niemeyer and placed into the public domain. It is a hierarchical spatial data structure which subdivides space into buckets of grid shape, which is one of the many applications of what is known as a Z-order curve, and generally space-filling curves.

ProximityPyHash generates a set of geohashes that cover a circular area, given the center coordinates and the radius. It also has an additional option to use GeoRaptor that creates the best combination of geohashes across various levels to represent the circle, starting from the highest level and iterating till the optimal blend is brewed. Result accuracy remains the same as that of the starting geohash level, but data size reduces considerably, thereby improving speed and performance.

Usage

$ proximityhash -h


  usage: proximityhash [-h] [--georaptor GEORAPTOR] [--minlevel MINLEVEL]
                     [--maxlevel MAXLEVEL]
                     latitude longitude radius precision_level

  positional arguments:
      latitude              latitude of the center point
      longitude             longitude of the center point
      radius                radius of coverage in metres
      precision_level       geohash precision level

  optional arguments:
      -h, --help            show this help message and exit
      --georaptor GEORAPTOR georaptor flag to compress the output (default: false)
      --minlevel MINLEVEL   minimum level of geohash if georaptor set to true(default: 1)
      --maxlevel MAXLEVEL   maximum level of geohash if georaptor set to true(default: 12)

Example

$ proximitypyhash 48.858156 2.294776 1000 7

$ proximitypyhash 48.858156 2.294776 2000 7 --georaptor true

$ proximitypyhash 48.858156 2.294776 2000 7 --georaptor true --minlevel 3 --maxlevel 6

In-Code Usage Example

You can use the code also as a library in your application:

import proximitypyhash
proximitypyhash.get_geohash_radius_approximation(latitude=12.0,longitude=77.0,radius=20.0,precision=8,georaptor_flag=False,minlevel=1,maxlevel=12)

Installation

To install proximitypyhash, simply:

$ pip install proximitypyhash

Development Setup using pyenv

Install pyenv and pyenv virtualenv:

brew install pyenv
brew install pyenv-virtualenv

Create and activate the virtualenv:

pyenv virtualenv proximitypyhash
pyenv activate proximitypyhash
python setup.py develop

Run the tests

python setup.py test

License:

The code is orginally from Ashwin Nair, I just made some changes to it to make the setup smoother and added testing functionality with a better setup.

Licensed under the Apache License, Version 2.0.

Copyright 2017 Ashwin Nair <https://www.linkedin.com/in/nairashwin7>
Copyright 2017 Alexander Mueller <https://www.linkedin.com/in/alexander-m%C3%BCller-727315a7/>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Contributors:

proximityhash's People

Contributors

ashwin711 avatar dice89 avatar

Stargazers

 avatar Andrew Blake avatar Tom Milligan avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.