void newpos(ref double lat, ref double lon, double bearing, double distance)
{
// '''extrapolate latitude/longitude given a heading and distance
// thanks to http://www.movable-type.co.uk/scripts/latlong.html
// '''
// from math import sin, asin, cos, atan2, radians, degrees
double radius_of_earth = 6378100.0;//# in meters
double lat1 = radians(lat);
double lon1 = radians(lon);
double brng = radians((bearing+360) % 360);
double dr = distance / radius_of_earth;
double lat2 = Math.Asin(Math.Sin(lat1) * Math.Cos(dr) +
Math.Cos(lat1) * Math.Sin(dr) * Math.Cos(brng));
double lon2 = lon1 + Math.Atan2(Math.Sin(brng) * Math.Sin(dr) * Math.Cos(lat1),
Math.Cos(dr) - Math.Sin(lat1) * Math.Sin(lat2));
lat = degrees(lat2);
lon = degrees(lon2);
//return (degrees(lat2), degrees(lon2));
}