tipsywacky
tipsywacky

Reputation: 3464

Getting the latitude and longitude from an address using pygeocoding

It might be kinda noob to ask. Sorry about that. tried this https://github.com/mutaku/pygeocoding library and did a LookUp like so

print LookUp(latlng="39.9518819802915,-75.1476150197085")

But it gave me

'init() should return None'

What did I do wrong?

Thanks in advance.

Upvotes: 2

Views: 572

Answers (1)

Ashwini Chaudhary
Ashwini Chaudhary

Reputation: 251136

I think there's a bug in that code, replace the line:

return result

with

self.result=result  #assign the result to a LookUp instance 

and then run:

In [1]: from pygeocoding import *

In [2]: r=LookUp(latlng="39.9518819802915,-75.1476150197085")

In [3]: r.result
Out[3]: 

{u'results': [{u'address_components': [{u'long_name': u'400',
     u'short_name': u'400',
     u'types': [u'street_number']},
    {u'long_name': u'Arch Street',
     u'short_name': u'Arch St',
     u'types': [u'route']},
    {u'long_name': u'Center City',
     u'short_name': u'Center City',
     u'types': [u'neighborhood', u'politi ....................}

Upvotes: 3

Related Questions