Skip to main content

Simple GEO library based on Redis GEO function

Project description

GEO Python

https://img.shields.io/pypi/v/geo_python.svg https://img.shields.io/travis/jerryleooo/geo_python.svg Documentation Status Updates

Simple GEO library based on Redis GEO commands

From version 3.2, Redis contains a set of very wonderful commands: the GEO commands (https://redis.io/commands#geo)

With these commands, we can easily develop LBS or GEO application.

Unfortunately, these features are not in redis-py(https://github.com/andymccurdy/redis-py) released packages, so we can only use its development version.

Get Started

In [1]: from geo_python import Point
In [2]: class MyPoint(Point):
   ...:     __key__ = 'my_point'
   ...:


In [3]: point = MyPoint.create(120, 40, 'my point 1')
In [4]: MyPoint.query_by_pos(point.longitude, point.latitude)
Out[4]: [<MyPoint __key__:my_point longitude:120.000000894 latitude:39.9999999108 member:my point 1>]


In [5]: MyPoint.query_by_member(point.member)
Out[5]: [<MyPoint __key__:my_point longitude:120.000000894 latitude:39.9999999108 member:my point 1>]


In [6]: point.update(member='my point 2')
In [7]: print point.member
my point 2

In [8]: another_point = MyPoint.get_by_member(point.member)

In [9]: print another_point
<MyPoint __key__:my_point longitude:120.000000894 latitude:39.9999999108 member:my point 2>

In [10]: print MyPoint.dist(point, another_point)
0.0

In [11]: point.geo_hash()
Out[11]: 'wxj7d9v2fs0'

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2016-12-30)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geo_python-0.1.0.tar.gz (18.4 kB view details)

Uploaded Source

File details

Details for the file geo_python-0.1.0.tar.gz.

File metadata

  • Download URL: geo_python-0.1.0.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for geo_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9cccc7e980a10c949dbff2b1ba0bddeb0004380e159017c708153cdeb7972299
MD5 e97f04e076d3e9ebae4bab709d6c2ee4
BLAKE2b-256 7f0fa66b74e7b82cf8155b44c8773b5e674ed2be2657f9166ac2eebb9e4c38b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page