January 18, 200917 yr Below is a small gauge I made by extracting some code from the Nav-Info gauge by Edi Hirsch (Avsim library - FS2004 gauges). I would like to modify it to show only the nearest airport that has a runway of 4000 feet or longer - but I can't figure out how to make it ignore all the short airstrips.Can it be done? Cheers, Bob ****************************<Gauge Name="NearestAirport"> <Macro Name="c">C:fs9gps</Macro> <Element> <Rectangle Width="100" Height="60" LineWidth="1.5" Color="Brown" FillColor="Black"/> </Element> <Update Hidden = "No">(A:GPS POSITION LAT, Radians) (>@c:NearestAirportCurrentLatitude, Radians) (A:GPS POSITION LON, Radians) (>@c:NearestAirportCurrentLongitude, Radians) 5 (>@c:NearestAirportMaximumItems) 20 (>@c:NearestAirportMaximumDistance, NMiles)</Update><Element> <Position X="4" Y="5"/> <FormattedText X="90" Y="50" Length="30" FontSize="14" Adjust="Left" Tabs="0,10" Color="White"> <String> %((@c:NearestAirportItemsNumber) 1) %((@c:NearestAirportCurrentIdent))%!s!\t\t\t %((@c:NearestAirportCurrentTrueBearing, degrees) (A:GPS MAGVAR, degrees) - d360)%!03d!°\t\t\t %((@c:NearestAirportCurrentDistance, nmiles))%!.1f! nm\n\n\t\t\t\t\t\t %((@c:NearestAirportCurrentLongestRunwayLength, feet))%!d! ft </String> </FormattedText> </Element></Gauge> Dell410, Core2Duo E6700, 2.66Ghz, 2GB ram, nVidia 7900GTX/512MB/195.62 driver, FSX/sp1, UTX USA, Fsgenesis
January 19, 200917 yr Below is a small gauge I made by extracting some code from the Nav-Info gauge by Edi Hirsch (Avsim library - FS2004 gauges). I would like to modify it to show only the nearest airport that has a runway of 4000 feet or longer - but I can't figure out how to make it ignore all the short airstrips.Can it be done? Cheers, Bob ****************************<Gauge Name="NearestAirport"> <Macro Name="c">C:fs9gps</Macro> <Element> <Rectangle Width="100" Height="60" LineWidth="1.5" Color="Brown" FillColor="Black"/> </Element> <Update Hidden = "No">(A:GPS POSITION LAT, Radians) (>@c:NearestAirportCurrentLatitude, Radians) (A:GPS POSITION LON, Radians) (>@c:NearestAirportCurrentLongitude, Radians) 5 (>@c:NearestAirportMaximumItems) 20 (>@c:NearestAirportMaximumDistance, NMiles)</Update><Element> <Position X="4" Y="5"/> <FormattedText X="90" Y="50" Length="30" FontSize="14" Adjust="Left" Tabs="0,10" Color="White"> <String> %((@c:NearestAirportItemsNumber) 1) %((@c:NearestAirportCurrentIdent))%!s!\t\t\t %((@c:NearestAirportCurrentTrueBearing, degrees) (A:GPS MAGVAR, degrees) - d360)%!03d! Paul EGLD
January 19, 200917 yr Author Hi Bob try%((@c:NearestAirportCurrentLongestRunwayLength, feet) s1 4000 >)%{if}%(l1)%!d! ft%{end}Thank you! Works fine. Now if I can only figure out why the range is erratic. Some airports show up at about 20 miles but most don't pop up until I'm within 4 or 5 miles.It is a puzzlement.Regards, Bob Dell410, Core2Duo E6700, 2.66Ghz, 2GB ram, nVidia 7900GTX/512MB/195.62 driver, FSX/sp1, UTX USA, Fsgenesis
January 20, 200917 yr With the code you have now the "CLOSEST" airport will always be the oneselected for data retrieval as NearestAirportCurrentLine is not set ( = 0 ) .In the update section you should check for the runway length and incrementthe NearestAirportCurrentLine if NearestAirportCurrentLongestRunwayLengthis under 4000 ft. I would also increase the max number and distance too !!EX. not tested - CODE <Gauge Name="NearestAirport">[Macro Name="c">C:fs9gps</Macro><Element><Rectangle Width="100" Height="60" LineWidth="1.5" Color="Brown" FillColor="Black"/></Element><Update Hidden = "Yes">(A:GPS POSITION LAT, Radians) (>@c:NearestAirportCurrentLatitude, Radians) (A:GPS POSITION LON, Radians) (>@c:NearestAirportCurrentLongitude, Radians) 50 (>@c:NearestAirportMaximumItems) 100 (>@c:NearestAirportMaximumDistance, NMiles) (L:TempLine, Number) (>@c:NearestAirportCurrentLine, Number)(L:TempLine, Number) 49 == if{ 0 (>L:TempLine, Number) } els{ (@c:NearestAirportCurrentLongestRunwayLength, feet) 4000 < if{ (L:TempLine, Number) ++ (>L:TempLine, Number) } els{ (L:TempLine, Number) (>L:AirportLine, Number) 0 (>L:TempLine, Number) }}</Update><Element><Position X="4" Y="5"/><FormattedText X="90" Y="50" Length="30" FontSize="14" Adjust="Left" Tabs="0,10" Color="White"><String>%((L:AirportLine, Number) (>@c:NearestAirportCurrentLine, Number))%%((@c:NearestAirportCurrentIdent))%!s!\t\t\t%((@c:NearestAirportCurrentTrueBearing, degrees) (A:GPS MAGVAR, degrees) - d360)%!03d! FS RTWR SHRS F-111 JoinFS Little Navmap
January 20, 200917 yr Author With the code you have now the "CLOSEST" airport will always be the oneselected for data retrieval as NearestAirportCurrentLine is not set ( = 0 ) .In the update section you should check for the runway length and incrementthe NearestAirportCurrentLine if NearestAirportCurrentLongestRunwayLengthis under 4000 ft. I would also increase the max number and distance too !!EX. not tested -CODE <Gauge Name="NearestAirport">[Macro Name="c">C:fs9gps</Macro><Element><Rectangle Width="100" Height="60" LineWidth="1.5" Color="Brown" FillColor="Black"/></Element><Update Hidden = "Yes">(A:GPS POSITION LAT, Radians) (>@c:NearestAirportCurrentLatitude, Radians) (A:GPS POSITION LON, Radians) (>@c:NearestAirportCurrentLongitude, Radians) 50 (>@c:NearestAirportMaximumItems) 100 (>@c:NearestAirportMaximumDistance, NMiles) (L:TempLine, Number) (>@c:NearestAirportCurrentLine, Number)(L:TempLine, Number) 49 == if{ 0 (>L:TempLine, Number) } els{ (@c:NearestAirportCurrentLongestRunwayLength, feet) 4000 < if{ (L:TempLine, Number) ++ (>L:TempLine, Number) } els{ (L:TempLine, Number) (>L:AirportLine, Number) 0 (>L:TempLine, Number) }}</Update><Element><Position X="4" Y="5"/><FormattedText X="90" Y="50" Length="30" FontSize="14" Adjust="Left" Tabs="0,10" Color="White"><String>%((L:AirportLine, Number) (>@c:NearestAirportCurrentLine, Number))%%((@c:NearestAirportCurrentIdent))%!s!\t\t\t%((@c:NearestAirportCurrentTrueBearing, degrees) (A:GPS MAGVAR, degrees) - d360)%!03d! Dell410, Core2Duo E6700, 2.66Ghz, 2GB ram, nVidia 7900GTX/512MB/195.62 driver, FSX/sp1, UTX USA, Fsgenesis
February 15, 201214 yr Commercial Member While I realize this topic is old I am having some trouble setting up what you fellas seem to have succesfully done.Here is my update code: (L:FMC-IRU-POS-LAT-CURRENT,degrees) (>C:FS9GPS:NearestAirportCurrentLatitude,degrees)(L:FMC-IRU-POS-LON-CURRENT,degrees) (>C:FS9GPS:NearestAirportCurrentLongitude,degrees)50 (>C:FS9GPS:NearestAirportMaximumItems,number)592640 (>C:FS9GPS:NearestAirportMaximumDistance,meters)(L:NearestAirportTempLine,number) (>@c:NearestAirportCurrentLine,number)(L:NearestAirportTempLine,number) 49 ==if{ 0 (>L:NearestAirportTempLine,number) }els{ (@c:NearestAirportCurrentLongestRunwayLength,feet) 3500 <if{ (L:NearestAirportTempLine,number) 1 + (>L:NearestAirportTempLine,number) }els{ (L:NearestAirportTempLine,number) (>L:NearestAirportCurrentLine,number) 0 (>L:NearestAirportTempLine,number) } } Now my string code: <Element><FormattedText X="275" Y="230" Bright="Yes" Font="Calibri" FontSize="15" Adjust="left" Color="%( (L:FMC-BRT,number) 0x7f +0x100 * )%" LineSpacing="15" Tabs="15,25L,125R,140C,195R,255R,265R" ><ScrollY>(L:data counter,number) 30 * (@g:listScroll) |</ScrollY><String>{lsp=50}%((@c:NearestAirportItemsNumber) s2 0 !=)%{if}%((L:NearestAirportCurrentLine,number) sp1)%{loop}%(l1 (>@c:NearestAirportCurrentLine))%{end}%((@c:NearestAirportCurrentIdent))%!s!t%((@c:NearestAirportCurrentTrueBearing,degrees) (A:GPS MAGVAR,degrees) - d360)%!03d! °Mtt%((@c:NearestAirportCurrentDistance,nmiles))%!3.1f!NMtt%((@c:NearestAirportCurrentLongestRunwayLength,feet))%!d!FT%(l1 ++ s1 l2 < d)%{if}n%{end}%{next}</String></FormattedText><Clip Top="65" Bottom="215" /></Element> While I'm not getting the original list I was getting without the little filter I am still getting lots of airports with runways far below 3500 ft. I am curious if it is possible to add a filter based on ICAO. I want to filter out all the airports that have less than 4 letter ICAO. Good Day, Engjell Berisha
February 15, 201214 yr Not tested, try slen, string length. %((@c:NearestAirportCurrentIdent) slen 3 >)%{if}etc. Edited February 15, 201214 yr by phjvh Jan "Beatus ille qui procul negotiis..."
February 15, 201214 yr HiI did this long time ago for FS9 should work in FSXTry this.Get your list of (@c:NearestAirportCurrentLongestRunwayLength,feet) run the list (@c:NearestAirportCurrentlineLine,Number) (@c:NearestAirportCurrentLongestRunwayLength,feet) 3500 ft > and store the matching (@c:NearestAirportCurrentlineLine,Number) to (L:CurrentSelectedRunwayLength,number) Then(L:CurrentSelectedRunwayLength,number) (>@c:NearestAirportCurrentlineLine,Number) other runway information you want to display for runways over 3500 ftDisplay in an array . Paul EGLD
February 16, 201214 yr Commercial Member The trouble I'm having with this is that it will not work in a loop for example. The code I am using it below: <Element><FormattedText X="275" Y="230" Bright="Yes" Font="Calibri" FontSize="15" Adjust="left" Color="%( (L:FMC-BRT,number) 0x7f + 0x100 * )%" LineSpacing="15" Tabs="15,25L,125R,140C,195R,255R,265R" ><ScrollY>(L:data counter,number) 30 * (@g:listScroll) |</ScrollY><String>\{lsp=50}%((L:NearestAirportCurrentLine,number) 0 sp1)[/color][color=#000000]%{loop}%(l1 (>@c:NearestAirportCurrentLine))%((@c:NearestAirportCurrentICAO))%!s!\t%((@c:NearestAirportCurrentTrueBearing,degrees) (A:GPS MAGVAR,degrees) - d360)%!03d! °M\t\t%((@c:NearestAirportCurrentDistance,nmiles))%!3.1f!NM\t\t%((@c:NearestAirportCurrentLongestRunwayLength,feet))%!d!FT\n%(l1 ++ s1)%{next}</String></FormattedText><Clip Top="65" Bottom="215" /></Element> Now the first airport in the loop is always an airport with a runway of at least 3500 ft or more. However every other airport is not affected by that code.I have tried doing something like this: <Element><FormattedText X="275" Y="230" Bright="Yes" Font="Calibri" FontSize="15" Adjust="left" Color="%( (L:FMC-BRT,number) 0x7f +0x100 * )%" LineSpacing="15" Tabs="15,25L,125R,140C,195R,255R,265R" ><ScrollY>(L:data counter,number) 30 * (@g:listScroll) |</ScrollY><String>\{lsp=50}%((L:NearestAirportCurrentLine,number) 0 sp1)%((@c:NearestAirportCurrentIdent) 3 <=)%{if}%(l1 ++ s1)%{end}%{loop}%(l1 (>@c:NearestAirportCurrentLine))%((@c:NearestAirportCurrentIdent))%!s!\t%((@c:NearestAirportCurrentTrueBearing,degrees) (A:GPS MAGVAR,degrees) - d360)%!03d! °M\t\t%((@c:NearestAirportCurrentDistance,nmiles))%!3.1f!NM\t\t%((@c:NearestAirportCurrentLongestRunwayLength,feet))%!d!FT\n%(l1 ++ s1)%{next}</String></FormattedText><Clip Top="65" Bottom="215" /></Element> But using that or %((@c:NearestAirportCurrentLongestRunwayLength,feet) 3500 <=)%{if}..... but it seems not to have any affect. Good Day, Engjell Berisha
February 16, 201214 yr The code you show is only for displaySomething like this:-Run the first loop outside the display to get the matching airports to displayWhen(@c:NearestAirportCurrentlineLine,Number) s1 (@c:NearestAirportCurrentLongestRunwayLength,feet) 3500 ft > l1 Take l1 and store to (>L:Any,number) Now (L:Any,number) has a number that matches RW 3500 >(>L:Any,number) (@c:NearestAirportCurrentlineLine,Number) (>@c:NearestAirportCurrentIdent) or any information you want from (@c:NearestAirportCurrentlineLine,Number) listyou have to display single numbers in a text list or if you want lots put them in an array Edited February 16, 201214 yr by pve Paul EGLD
February 16, 201214 yr Commercial Member <Element><FormattedText X="275" Y="230" Bright="Yes" Font="Calibri" FontSize="15" Adjust="left" Color="%( (L:FMC-BRT,number) 0x7f +0x100 * )%" LineSpacing="15" Tabs="15,25L,125R,140C,195R,255R,265R" ><ScrollY>(L:FMC-DATA-PAGE,number) 30 *</ScrollY><String>{lsp=50}%((@c:NearestIntersectionItemsNumber) 0 !=)%{if}%((L:NearestAirportTempLine,number) 49 == if{ 0 (>L:NearestAirportTempLine,number) }els{ (@c:NearestAirportCurrentLongestRunwayLength,feet) 3500 < (@c:NearestAirportCurrentIdent) slen 3 <= ||if{ (L:NearestAirportTempLine,number) 1 + (>L:NearestAirportTempLine,number) (>L:NearestAirportCurrentLine,number) }els{ (L:NearestAirportTempLine,number) (>L:NearestAirportCurrentLine,number) 0 (>L:NearestAirportTempLine,number) } }(L:NearestAirportTempLine,number) (>@c:NearestAirportCurrentLine,number))%((L:NearestAirportCurrentLine,number) sp1)%((@c:NearestAirportCurrentAirportKind) 1 == (@c:NearestAirportCurrentLongestRunwayLength,feet) 3500 > and)%{if}%{loop}%(l1 (>@c:NearestAirportCurrentLine))%((@c:NearestAirportCurrentIdent))%!s!t%((@c:NearestAirportCurrentTrueBearing,degrees) (A:GPS MAGVAR,degrees) - d360)%!03d!°Mtt%((@c:NearestAirportCurrentDistance,nmiles))%!3.1f!NMtt%((@c:NearestAirportCurrentLongestRunwayLength,feet))%!d!FTn%(l1 ++ s1)%{next}%{end}%{end}</String></FormattedText><Clip Top="68" Bottom="215"/></Element> Yea I realized I posted the wrong code now. The above is what I'm using but I still get airports that have the longest runway below my requirement.This is just really frustrating. I'm on the ground at KRUT. It has a runway of 5000ft. I use the code on my ND also to filter out airports with fields smaller than 3500 ft and with the code:<Visible>(@c:NearestAirportCurrentLongestRunwayLength,feet) 3500 >=</Visible>KRUT disappears but a field VT20 with a turf runway of 1750 ft appears. I can not make any sense of this. Good Day, Engjell Berisha
Create an account or sign in to comment