#NEWLINE# def reverse( self , query , exactly_one = True , timeout = None , distance = None , wkid = DEFAULT_WKID ) : #NEWLINE# #INDENT# '\n        Given a point, find an address.\n\n        :param query: The coordinates for which you wish to obtain the\n            closest human-readable addresses.\n        :type query: :class:`geopy.point.Point`, list or tuple of (latitude,\n            longitude), or string as "%(latitude)s, %(longitude)s".\n\n        :param bool exactly_one: Return one result, or a list?\n\n        :param int timeout: Time, in seconds, to wait for the geocoding service\n            to respond before raising a :class:`geopy.exc.GeocoderTimedOut`\n            exception. Set this only if you wish to override, on this call\n            only, the value set during the geocoder\'s initialization.\n\n        :param int distance: Distance from the query location, in meters,\n            within which to search. ArcGIS has a default of 100 meters, if not\n            specified.\n\n        :param string wkid: WKID to use for both input and output coordinates.\n        ' #NEWLINE# point = self . _coerce_point_to_string ( query ) . split ( ',' ) #NEWLINE# if ( wkid != DEFAULT_WKID ) : #NEWLINE# #INDENT# location = { #NEWLINE# #INDENT# 'x' : point [ 1 ] , #NEWLINE# 'y' : point [ 0 ] , #NEWLINE# 'spatialReference' : wkid , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# location = ',' . join ( ( point [ 1 ] , point [ 0 ] ) ) #NEWLINE# #UNINDENT# params = { #NEWLINE# #INDENT# 'location' : location , #NEWLINE# 'f' : 'json' , #NEWLINE# 'outSR' : wkid , #NEWLINE# #UNINDENT# } #NEWLINE# if ( distance is not None ) : #NEWLINE# #INDENT# params [ 'distance' ] = distance #NEWLINE# #UNINDENT# url = '?' . join ( ( self . reverse_api , urlencode ( params ) ) ) #NEWLINE# logger . debug ( '%s.reverse: %s' , self . __class__ . __name__ , url ) #NEWLINE# response = self . _call_geocoder ( query , timeout = timeout ) #NEWLINE# if ( not len ( response ) ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# if ( 'error' in response ) : #NEWLINE# #INDENT# if ( response [ 'error' ] [ 'code' ] == self . _TOKEN_EXPIRED ) : #NEWLINE# #INDENT# self . retry += 1 #NEWLINE# self . _refresh_authentication_token ( ) #NEWLINE# return self . reverse ( query , exactly_one = exactly_one , timeout = timeout , distance = distance , wkid = wkid ) #NEWLINE# #UNINDENT# raise GeocoderServiceError ( str ( response [ 'error' ] ) ) #NEWLINE# #UNINDENT# address = ( '%(Address)s, %(City)s, %(Region)s %(Postal)s, %(CountryCode)s' % response [ 'address' ] ) #NEWLINE# return Location ( address , ( response [ 'location' ] [ 'y' ] , response [ 'location' ] [ 'x' ] ) , response [ 'address' ] )