Giter Site home page Giter Site logo

geolib's People

Contributors

azmeuk avatar joyanujoy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

geolib's Issues

side effect on decimal

_fixedpoint() has a side effect on decimal context.

Python 3.7.4 (v3.7.4:e09359112e, Jul  8 2019, 14:54:52) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import geolib.geohash
>>> import decimal
>>> decimal.getcontext().prec
28
>>> geolib.geohash.decode('9q8')
Point(lat=Decimal('37.265625'), lon=Decimal('-123.046875'))
>>> decimal.getcontext().prec
1
>>> decimal.Decimal('17') % 1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
decimal.InvalidOperation: [<class 'decimal.DivisionImpossible'>]

Expect decimal to be unchanged.

pypi sdist archive misses some files

It seems that the sdist archive at pypi is missing some files which are all present when building the sdist (locally), for example the LICENSE file and the docs & tests directory.

ValueError: substring not found Error when handling look up from a dict

I run into substring not found Error when attempting to find neighbors for a geohash. I am passing geohash of type string, as per the documentation, however, I am still seeing this issue. Here's my code:


    import pandas as pd
    import pygeohash as gh
    from geolib import geohash

    geo_dict = {'9q5dx': 10, '9q9hv': 15, '9q5dv': 20}
    
    
    df = pd.DataFrame({'geohash': ['9q5dx','9qh0g','9q9hv','9q5dv'],
                       'label': ['a', 'b', 'c', 'd']})
    
    try:
        
        df['value'] = df.apply(lambda x : geo_dict[x.geohash], axis=1)
        
    except Exception as e:
        
        g = str(e)
        
        print(g, type(g))
        
        neighbours = geohash.neighbours(g)

`9qh0g' <class 'str'>`



ValueError                                Traceback (most recent call last)
<ipython-input-488-e803623c09eb> in <module>
     18     print(g, type(g))
     19 
---> 20     neighbours = geohash.neighbours(g)
     21 

~/opt/anaconda3/lib/python3.8/site-packages/geolib/geohash.py in neighbours(geohash)
    254     >>> gcpuypm
    255     """
--> 256     n = adjacent(geohash, 'n')
    257     ne = adjacent(n, 'e')
    258     e = adjacent(geohash, 'e')

~/opt/anaconda3/lib/python3.8/site-packages/geolib/geohash.py in adjacent(geohash, direction)
    232         parent = adjacent(parent, direction)
    233 
--> 234     index = neighbour[direction][typ].index(last_char)
    235     return parent + base32[index]
    236 

    ValueError: substring not found

When I hard code it, I get the expect result:

 geohash.neighbours('9qh0g')

 Neighbours(n='9qh15', ne='9qh1h', e='9qh0u', se='9qh0s', s='9qh0e', sw='9qh0d', w='9qh0f', nw='9qh14')

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.