#NEWLINE# def dist_to_deg( self , distance , latitude ) : #NEWLINE# #INDENT# "\n        distance = distance in meters\n        latitude = latitude in degrees\n\n        at the equator, the distance of one degree is equal in latitude and longitude.\n        at higher latitudes, a degree longitude is shorter in length, proportional to cos(latitude)\n        http://en.wikipedia.org/wiki/Decimal_degrees\n\n        This function is part of a distance filter where the database 'distance' is in degrees.\n        There's no good single-valued answer to this problem.\n        The distance/ degree is quite constant N/S around the earth (latitude),\n        but varies over a huge range E/W (longitude).\n\n        Split the difference: I'm going to average the the degrees latitude and degrees longitude\n        corresponding to the given distance. At high latitudes, this will be too short N/S\n        and too long E/W. It splits the errors between the two axes.\n\n        Errors are < 25 percent for latitudes < 60 degrees N/S.\n        " #NEWLINE# lat = ( latitude if ( latitude >= 0 ) else ( ( - 1 ) * latitude ) ) #NEWLINE# rad2deg = ( 180 / pi ) #NEWLINE# earthRadius = 6378160.0 #NEWLINE# latitudeCorrection = ( 0.5 * ( 1 + cos ( ( ( lat * pi ) / 180 ) ) ) ) #NEWLINE# return ( ( distance / ( earthRadius * latitudeCorrection ) ) * rad2deg )