#NEWLINE# def point_to_address( self ) : #NEWLINE# #INDENT# "\n        Given GeoRSS point, it retrieves GeoLocation information\n        in form of String\n        the return value of geocoder.reverse is in the form\n        (u'Street name, Street Number, Postcode City Province, Country',\n        (latitude, longitude))\n        " #NEWLINE# point = geopy . point . Point . from_string ( self . georss_point ) #NEWLINE# try : #NEWLINE# #INDENT# geocoder = geopy . geocoders . Google ( settings . GOOGLE_MAPS_API_KEY ) #NEWLINE# geocoding_result = geocoder . reverse ( ( point . latitude , point . longitude ) ) #NEWLINE# full_address = geocoding_result [ 0 ] . split ( ',' ) #NEWLINE# if ( len ( full_address ) == 4 ) : #NEWLINE# #INDENT# self . street = ( ( full_town [ 0 ] + ',' ) + full_address [ 1 ] ) #NEWLINE# self . postcode = int ( full_address [ 2 ] . split ( ' ' ) [ 1 ] ) #NEWLINE# full_town = full_address [ 2 ] . split ( ' ' ) [ 2 : ] #NEWLINE# self . town = ' ' . join ( full_town ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( full_address ) == 3 ) : #NEWLINE# #INDENT# self . street = full_address [ 0 ] #NEWLINE# self . postcode = int ( full_address [ 1 ] . split ( ' ' ) [ 1 ] ) #NEWLINE# full_town = full_address [ 1 ] . split ( ' ' ) [ 2 : ] #NEWLINE# self . town = ' ' . join ( full_town ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . town = full_address [ 0 ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except Exception : #NEWLINE# #INDENT# self . town = '' #NEWLINE# self . street = '' #NEWLINE# self . postcode = 0 #NEWLINE# #UNINDENT# self . georss_point_latitude = point . latitude #NEWLINE# self . georss_point_longitude = point . longitude