Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Lat and Lon discrepancy?

Featured Replies

  • Commercial Member

I hope the final answer to this is not going to be too embarrassing...In Slew mode, Lat/Lon is showing as N47 25 91 / W122 18 48If I use PLANE_LATITUDE and PLANE_LONGITUDE and run them through the conversions in fsgauges_sp2.h I get N 47 43 17 / W-122 30 79.The conversions in my modified gauges.h file are

#define FS_LATITUDE_DEG(val)	((val)/FS_LAT_FACTOR)		//where FS_LAT_FACTOR = 111130.555557#define FS_LONGITUDE_DEG(val) ((val)>140737488355332)?(val)/FS_LON_FACTOR-360.0:(val)/FS_LON_FACTOR //where FS_LON_FACTOR = 781874935307.40

My display code for two strings is:

lookup_var(&currlat);sprintf(pelement->string, "%12s%4.6f"," Latitude = ",FS_LATITUDE_DEG(currlat.var_value.n));lookup_var(&currlon);sprintf(pelement->string, "%13s%4.6f"," Longitude = ",FS_LONGITUDE_DEG(currlon.var_value.n));

I haven't been putting out misleading information all these years, have I?-Dai

Dai, Just a shot in the dark.. Believe the result you're getting is Decimal Degrees, where the output from FS is Degrees/Decimal Minutes with a ceiling on the remainder minutes. DD.DDDD yoursDD mm.mm Fs slew display47 43 17(47) 47.4317 - 47 = .4317.4317 * 60 = 25.902 (25)25.902 - 25 = .902 .902 * 100 = 90.2 ceil = (91)47 25.91122 30 79(122)122.3079 - 122 = .3079 .3079 * 60 = 18.474 (18)18.474 -18 = .474 .474 * 100 = 47.4 ceil = (48)122 18.48Just how the output is formatted, dats all :-) Better off doing calculations with your "raw" output.

Here are some conversions, courtesy of Arne.. Sorry XML. <String>%((A:PLANE LATITUDE, degrees) d 0 >= s0 r abs d 3600 * 60 % r d 60 * 60 % flr r flr 'N' 'S' l0 ? )%!s!%!02.0f!°%!02.0f!'%!02.0f!"</String><String>%((A:PLANE LONGITUDE, degrees) d 0 >= s0 r abs d 3600 * 60 % r d 60 * 60 % flr r flr 'E' 'W' l0 ? )%!s!%!03.0f!°%!02.0f!'%!02.0f!"</String><String>%((A:PLANE LATITUDE, degrees) d 0 >= )%{if}%N%{else}%S%{end}%( abs d flr )%!02d!°%( 1 % 60 * d flr )%!02d!'%( 1 % 60 * )%!02.0f"</String><String>%((A:PLANE LONGITUDE, degrees) d 0 >= )%{if}%E%{else}%W%{end}%( abs d flr )%!03d!°%( 1 % 60 * d flr )%!02d!'%( 1 % 60 * )%!02.0f"</String>

Roman

20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

  • Author
  • Commercial Member

Just FYI: this was my final conversion code.

//Convert the incoming FS data to decimalDecToMin(FS_xxxxITUDE_DEG(<data>.var_value.n));// Convert latlon degrees decimal to degrees and minutesint geodeg=0,geomin=0,geosec=0;void DecToMin(double degData){	double dblMin=0;	geodeg=(int)degData;	dblMin=degData-geodeg;	dblMin=fabs(dblMin*60);	geomin=(int)dblMin;	geosec=(int)ceil((dblMin-geomin)*100);	return;}

-Dai

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.