poi转geohash

时间:2021-06-25 06:12:39

import geohash
import sys
for line in sys.stdin:
fields = line.strip().split('\t')
hostid,POS_TIME,POS_LAT,POS_LONG=fields[0].strip(),fields[1].strip(),fields[2].strip(),fields[3].strip()
try:
Geoh = geohash.encode(float(POS_LAT),float(POS_LONG),6)
print '\t'.join([hostid,POS_TIME,Geoh])
except:
pass