I have this function in Python that calculate distance from a point with bearing. Problem is the latitude part is generating the wrong answer and i cannot figure out where i went wrong:
def add_distance(self, lat, lon, bearing, distance): d = distance/6371 x = sin(lat) * cos(d) + cos(lat) * sin(d) * cos(bearing) new_lat = asin( float(x) ) new_lon = lon + atan2(sin(bearing)*sin(distance/6371)*cos(lat), cos(distance/6371)-sin(lat)*sin(new_lat)) print '\tNew Lat:%s' % (new_lat ) print '\tNew Lon:%s' % new_lon return ''
أكثر...
def add_distance(self, lat, lon, bearing, distance): d = distance/6371 x = sin(lat) * cos(d) + cos(lat) * sin(d) * cos(bearing) new_lat = asin( float(x) ) new_lon = lon + atan2(sin(bearing)*sin(distance/6371)*cos(lat), cos(distance/6371)-sin(lat)*sin(new_lat)) print '\tNew Lat:%s' % (new_lat ) print '\tNew Lon:%s' % new_lon return ''
أكثر...