Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Geohash/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
License along with Geohash. If not, see
<http://www.gnu.org/licenses/>.
"""
from geohash import decode_exactly, decode, encode
from .geohash import decode_exactly, decode, encode
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ encoding Geohashes_ to and from latitude and longitude coordinates.
Example::

>>> import Geohash
>>> print 'Geohash for 42.6, -5.6:', Geohash.encode(42.6, -5.6)
>>> print('Geohash for 42.6, -5.6: ' + Geohash.encode(42.6, -5.6))
Geohash for 42.6, -5.6: ezs42e44yx96

You can specify an arbitrary precision when encoding. The precision
determines the number of characters in the Geohash::

>>> print 'Geohash for 42.6, -5.6:', Geohash.encode(42.6, -5.6, precision=5)
>>> print('Geohash for 42.6, -5.6: ' + Geohash.encode(42.6, -5.6, precision=5))
Geohash for 42.6, -5.6: ezs42

Decoding a Geohash returns a (latitude, longitude) tuple::

>>> print 'Coordinate for Geohash ezs42:', Geohash.decode('ezs42')
>>> print('Coordinate for Geohash ezs42: ' + str(Geohash.decode('ezs42')))
Coordinate for Geohash ezs42: ('42.6', '-5.6')

The Geohash module also provides exact decoding with error margin
results. The decode_exactly function returns a tuple of four float
values; latitude, longitude, latitude error margin, longitude error
margin::

>>> print 'Exact coordinate for Geohash ezs42:\n', Geohash.decode_exactly('ezs42')
>>> print('Exact coordinate for Geohash ezs42:\n' + str(Geohash.decode_exactly('ezs42')))
Exact coordinate for Geohash ezs42:
(42.60498046875, -5.60302734375, 0.02197265625, 0.02197265625)

Expand Down
Binary file added dist/Geohash-1.0-py3.6.egg
Binary file not shown.
Binary file removed dist/Geohash-1.0.tar.gz
Binary file not shown.
Binary file removed dist/Geohash-1.0rc1-py2.4.egg
Binary file not shown.
Binary file removed dist/Geohash-1.0rc1.tar.gz
Binary file not shown.
13 changes: 8 additions & 5 deletions test/testgeohash.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@

from __future__ import print_function

import os
import sys

# Test the source tree, not an installed version.
sys.path.insert(0, '../Geohash')

import geohash
os.chdir('..')
sys.path.insert(0, os.getcwd())

if __name__ == '__main__':
import doctest
print "Testing tests in README.rst..."
doctest.testfile('../README.rst')
print("Testing tests in README.rst...")
doctest.testfile('./README.rst')