0

I'm trying to read in a CSV of geohashes, to be converted to lat/longs. I'm using Python's Geohash module. Here's my code:

import Geohash
import csv
with open('C:\Users\Data\myData.csv') as csvfile:
    readCSV = csv.reader(csvfile, delimiter=',')
    for row in readCSV:
        geoHash = row[0]
        print(str(geoHash)) #This prints sucessfully
        geoStr = str(geoHash)
        Geohash.decode(geoStr) #This fails

The code only fails on the very last line, geoStr outputs each geohash successfully. The error I'm getting is:

Traceback (most recent call last):

File

"C:/Users/PycharmProjects/GeoHash/GeoHash_to_LatLong.py", line 11, in <module>
    Geohash.decode(geoStr)
  File "C:\Users\PycharmProjects\GeoHash\venv\lib\site-packages\Geohash\geohash.py", line 68, in decode
    lat, lon, lat_err, lon_err = decode_exactly(geohash)
  File "C:\Users\PycharmProjects\GeoHash\venv\lib\site-packages\Geohash\geohash.py", line 44, in decode_exactly
    cd = __decodemap[c]
KeyError: 'o'

I've checked the CSV and there doesn't appear to be any odd characters or anything that would cause this to fail. Any thoughts?

DiamondJoe12
  • 1,879
  • 7
  • 33
  • 81

0 Answers0