everythingme / geodis Goto Github PK
View Code? Open in Web Editor NEWA redis based geo-resolving library
A redis based geo-resolving library
File "/usr/local/lib/python2.7/dist-packages/geodis-2.0.3-py2.7.egg/geodis/city.py", line 57, in init
self.country = countries.get( kwargs.get('country', None), kwargs.get('country', '')).strip()
AttributeError: 'list' object has no attribute 'get'
Could not import geonames database...
Trying to follow the flow here.
https://github.com/EverythingMe/geodis/blob/master/geodis/index.py#L228
if not store:
redisConn.zunionstore(tmpKey, list(closest))
return redisConn.zrevrange(tmpKey, 0, -1, withscores=True)
else:
return list(closest)
It looks like if I don't want to store anything, I should pass store=True
Hi,
I think this is a great package that should be known more. Googles API allows only a few requests per day for free and has a network overhead (although it seems to offer more information).
For more than a handfull of requests I found Geodis a nice alternative, had to work a bit with the redis API (figuring out the correct db data were stored in) and with setting up symlinks to import the package.
Also the geobox branch is not switched to master yet and maybe that is because it threw out an error at me when I attempted to store data to redis with it. I figure its just a configuration error on my part.
So, to sum up, I guess this is not that much of an issue, as just thanks and maybe to lower the entry barrier a little bit more for beginners (althought API felt quite intuitive so far).
Thanks for sharing.
Seems like the geodis.ZIPCode.getByLatLon function will return a zip code and the country 'United States' no matter where in the world the latitude/longitude points are. Is there an easy way to determine country for these?
I assumed I could do geodis.City.getByLatLon first, but I cannot seem to get it to work reliably. Perhaps I am not getting the geonames data file loaded correctly or something. Here is what I see:
I call:
broadlocation = geodis.City.getByLatLon(latitude,longitude, conn)
and it fails fairly often after a few lookups (which the ZIPCode.getByLatLon never fails upon). This is what the failure looks like:
Traceback (most recent call last):
File "test.py", line 22, in
broadlocation = geodis.City.getByLatLon(latitude,longitude, conn)
File "/Users/jasontitus/Documents/geo-data/doat-geodis-d56cd38/src/location.py", line 98, in getByLatLon
return cls.getByGeohash(geoKey, redisConn)
File "/Users/jasontitus/Documents/geo-data/doat-geodis-d56cd38/src/location.py", line 157, in getByGeohash
return cls.load(str(candidates[selected][0]), redisConn)
File "/Users/jasontitus/Documents/geo-data/doat-geodis-d56cd38/src/location.py", line 84, in load
d = redisConn.hgetall(str(key))
File "/Library/Python/2.6/site-packages/redis-2.4.1-py2.6.egg/redis/client.py", line 978, in hgetall
File "/Library/Python/2.6/site-packages/redis-2.4.1-py2.6.egg/redis/client.py", line 239, in execute_command
File "/Library/Python/2.6/site-packages/redis-2.4.1-py2.6.egg/redis/client.py", line 245, in parse_response
File "/Library/Python/2.6/site-packages/redis-2.4.1-py2.6.egg/redis/connection.py", line 207, in read_response
File "/Library/Python/2.6/site-packages/redis-2.4.1-py2.6.egg/redis/connection.py", line 67, in read_response
File "/Library/Python/2.6/site-packages/redis-2.4.1-py2.6.egg/redis/connection.py", line 36, in read_response
redis.exceptions.ConnectionError: Socket closed on remote end
Any idea what the issue might be?
Hi,
I couldn't install geodis using PIP. There is an error: Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
I am trying to import the zipcodes data into the redis instance as specified on the ReadMe.
Using the command ./geodis -z -f data/zipcodes.csv -p 6369. All imports failed with a similar error to the one listed below. I have had no problem importing the cities.json file however.
KeyError: 'alaska'
2018-10-17 19:13:01,291 ERROR in zipcodes.runImport (zipcodes.py:129): Could not import line #43191: Ketchikan, {'lat': 61.385, 'code': 'AK', 'lon': -152.2683, 'name': 'Alaska'}: 'alaska'
Traceback (most recent call last):
File "/home/u1604342/.local/lib/python2.7/site-packages/geodis/provider/zipcodes.py", line 108, in runImport
stateId = features[stateName.lower()]['id']
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.