July 16, 200421 yr When I asked this question earlier there was an error in my reasoning. Here is a better way to state it:How do I find the distance between these two lat/long points in feet, where the coordinates are presented in decimal format?Point 1: Lat 42.984665, Long -87.831505Point 2: Lat 42.98461957, Long -87.83139252I
July 16, 200421 yr I use this:decimal y = (toPoint.Latitude.Radian - fromPoint.Latitude.Radian) * (40007000.0M / (decimal)(2.0 * Math.PI));decimal x = (toPoint.Longitude.Radian - fromPoint.Longitude.Radian) * (40075000.0M / (decimal)(2.0 * Math.PI)) * (decimal)Math.Cos((double)(toPoint.Latitude.Radian + fromPoint.Latitude.Radian) / 2.0);Don't mind the casting (datatypes in brackets). As you can see, I use radian instead of degrees, so you would have to adjust that.The constants used are from the FS SDK, and as far as I can see, this is very accurate when placed in FS.Output is in meters, so you would need to convert to feet.
July 17, 200421 yr Hmmmm, I would have no idea how to actually implement that code. I'm kind of new to all this. Also, I'm doing these calculations in Excel, not FS.
July 17, 200421 yr Author Hi Christine,I made a flight planning program, using Excel, and, as part of this program, I calculate distances between two airports.The formula I use is : =2*3437,74677*ASIN(RACINE(PUISSANCE(SIN(($R$2-G5)/2);2)+(COS($R$2)*COS(G5)*PUISSANCE(SIN(($S$2-H5)/2);2))))The answer is in NM.The latitude and longitude of the 1st point are $R$2 and $S$2.The latitude and longitude of the 2nd point are G5 and H5.The latitudes and longitudes are in radians.If you want to convert deg/min/sec in radians, you have first to express deg/min/sec in decimals : deg(decimal)=deg + min/60 + sec/3600, and multiply deg(decimal) by pi/180.Oh ! yes ! I use Excel in french : so RACINE means SQRT, and PUISSANCE is POWER. I think ASIN, SIN and COS are OK.Hope this helps !Alain
July 19, 200421 yr I currently have latitude and longitude expressed in decimal degrees. How do I convert decimal degrees to radians to use your formula. Just multiply by pi/180?I'm glad you mentioned about the French because I don't know if I would have figured that out! Merci!
July 19, 200421 yr Author Yes, just multiply by pi/180 !And just to be complete for my "translation" of the formula from French to English : the decimal comma should become a decimal point.If you want to find useful formulas for navigation purposes, go to this site : http://williams.best.vwh.net/avform.htmGood luck with your calculations !Alain
Create an account or sign in to comment