Archived

This topic is now archived and is closed to further replies.

Guest ridgell

trig and geocalc question

Recommended Posts

i am wanting to find lat/lon for a position under a cursor on a map...say a version of the gps map (for 1).if i recall my trig tan (X cursor offset from center)/(Y position) gives me the angle deviation from my own heading. how do i plug that into geocalc to get the lat/lon ?looks like i have geocalclength & geocalcazmuth1 to work with, i can compute the hypotinus as range/length? and i hope it is azmuth as in bearing and not declination...can some one who better knows help or point me in the right direction?geocalcbearing and geocalcdistance do not have check marks in the set column meaning i can retrive that data but cannot use it to compute other data with geocalc?do i need to plugin my own lat lon or is it assumed?

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

yiks! no answersperhaps i should move the cursor as a lat /lon useing law of sines and cosines, rather then the other way around...since i know how to use the lat/lon geocalc

Share this post


Link to post
Share on other sites

Hi Ridgell,Try :(yourPlaneLat) (>@c:GeoCalcLatitude1,degrees) (yourPlaneLon) (>@c:GeoCalcLongitude1,degrees) (BearingFromYourPlaneToYourcursor) (>@c:GeoCalcAzimuth1,degrees)(distanceFromYourPlaneToYourCursor) (>@c:GeoCalcLength,nmiles) Then read the Lat/Lon where your cursor is in(@c:GeoCalcExtrapolationLatitude,degrees)(@c:GeoCalcExtrapolationLongitude,degrees)And test is making the calcs manually, just in case :-)Tom

Share this post


Link to post
Share on other sites

El maestro de Gracias, yo esperaba que usted viera el poste. fue usted que me mostr

Share this post


Link to post
Share on other sites

TAQ, i am not getting any data back out of the geocalc.i am cutting and pasting the meat of the program;this is where i match the map size to the shift data for other lat lon displays ( which work perfectly, i even found the factor to keep a created position/waypoint fixed on the gps map ) s2 is the real size in nmiles, s1 is the displayed value Km rounded up) (L:MapRange,enum) 4 == (L:landswitch,bool) && if{ 5.225 s2 80 s1 } (* 209 / 40nm 74.08km *)(L:MapRange,enum) 3 == (L:landswitch,bool) && if{ 6.967 s2 60 s1 } (* 209 / 30nm 55.56km *) (L:MapRange,enum) 2 == (L:landswitch,bool) && if{ 10.45 s2 40 s1 } (* 209 / 20nm 37.04km *) (L:MapRange,enum) 1 == (L:landswitch,bool) && if{ 20.9 s2 20 s1 } (* 209 / 10nm 18.52km *) (L:MapRange,enum) 0 == (L:landswitch,bool) && if{ 41.8 s2 10 s1 } (* 209 / 5nm 10km *)(L:MapRange,enum) 4 == (L:landswitch,bool) ! && if{ 0.645 s2 600 s1 } (* 209 / 323.97nm 600km *)(L:MapRange,enum) 3 == (L:landswitch,bool) ! && if{ 0.967 s2 400 s1 } (* 209 / 215.98nm 400km *) (L:MapRange,enum) 2 == (L:landswitch,bool) ! && if{ 1.935 s2 200 s1 } (* 209 / 107.99nm 200km *) (L:MapRange,enum) 1 == (L:landswitch,bool) ! && if{ 2.580 s2 150 s1 } (* 209 / 80.994nm 150km *) (L:MapRange,enum) 0 == (L:landswitch,bool) ! && if{ 3.871 s2 100 s1 } (* 209 / 53.996nm 100km *)l1 (>L:readrange,enum) (y is negative because up/away on the radar is starting point - cursor position) @R l2 (>L:radranfactor,enum) (L:posX,enum) sqr (L:posY,enum) -1 * sqr + sqrt (L:radranfactor,enum) / (>L:cursorrange,nmiles) (L:posX,enum) (L:posY,enum) -1 * / atg rddg (A:Plane heading degrees gyro, degrees) + (>L:cursorbearing,degrees) (L:cursorbearing,degrees) 359 > if{ (L:cursorbearing,degrees) 360 - (>L:cursorbearing,degrees) } (L:cursorbearing,degrees) 0 < if{ (L:cursorbearing,degrees) 360 + (>L:cursorbearing,degrees) } (A:PLANE LATITUDE,degrees) (>@c:GeoCalcLatitude1,degrees) (A:PLANE LONGITUDE,degrees) (>@c:GeoCalcLongitude1,degrees) (L:cursorbearing,degrees) (>@c:GeoCalcAzimuth1,degrees) (L:cursorrange,nmiles) (>@c:GeoCalcLength,nmiles) (@c:GeoCalcExtrapolationLatitude,degrees) (>L:rlatitude9,enum) (@c:GeoCalcExtrapolationLongitude,degrees) (>L:rlongitude9,enum) the trig checks good, i can use points on the gps map to check the bearing and range for accuracy, useing a string test gauge to display the numbers. but (L:rlatitude9,enum) (L:rlongitude9,enum) are returning zeros.have you used the GeoCalcExtrapolation ?i have a pdf from a susan ashlock (msfs team member) explaining the GPS DATA (includes geocalc), and she states that the stuff that does not appear in the GPS500 (extrapolation does not) may be nonfunctional. you might notice in the center trig portion of my stuff i normalize my own degrees because i could not get 'rdeg' to work. would love to hear from anyone who has succesfully used geocalcextrapolation data.

Share this post


Link to post
Share on other sites

Hi Ridgell,GeocalcExtrapolationLat..Lon indeed show values, although I can't assure they match exactly with the respective coordinates (because I didn't have time to test it backwards :-))But I guess you need to use this syntax:... (>L:rlatitude9,degrees) ... (>L:rlongitude9,degrees) instead of "enum"; I think a zero return could be a FS internal conversion's problem.Besides, these sentences aren't really necessary :(L:cursorbearing,degrees) 359 > if{ (L:cursorbearing,degrees) 360 - (>L:cursorbearing,degrees) } (L:cursorbearing,degrees) 0 < if{ (L:cursorbearing,degrees) 360 + (>L:cursorbearing,degrees) } it's simpler to use this :... (A: Plane heading degrees gyro, degrees) + dnor (>L:cursorbearing,degrees) "dnor" normalizes any aritmethic operation to a 360 degrees limited value.Tom

Share this post


Link to post
Share on other sites

ola maestro, i took the dnor tip...thanks, i had cut and pasted the operators form the sdk and somehow did not get that one. i was trying to use 'rdeg' which did nothing. i can not duplicate your results with GeocalcExtrapolationLat..Lon,i replaced the offending 'enums' with unit designations, after reading the geocalc in the fsx sdk i tried to use meters instead of nmiles, and will try radians instead of degrees even though the sdk calls for degrees. i made a test gauge that just plugged in any old number to see if i could get a non zero proof that GeocalcExtrapolationLat..Lon will return some kind of value for GeoCalcAzimuth1, GeoCalcLength, and lat and lon inputs, i am getting nothing...zeros...looks dead to me. perhaps you could post what you used to get a result, and i can use that as a starting point to tweek my result.

Share this post


Link to post
Share on other sites

Hola Ridgell,Well, it happens that works good. To test it:1) Make an element with this in (@c:GeoCalcExtrapolationLatitude,degrees) (>L:Lat1,degrees)(@c:GeoCalcExtrapolationLongitude,degrees) (>L:Lon1,degrees)Then in a string, :Lat1 %((L:Lat1,degrees))%!3.4f! Lon1 %((L:Lon1,degrees))%!3.4f! You'll see 0 and 0.2) Modify your and put this:30.00 (>@c:GeoCalcLatitude1,degrees)-50.00 (>@c:GeoCalcLongitude1,degrees)0 (>@c:GeoCalcAzimuth1,degrees)20 (>@c:GeoCalcLength,nmiles)(@c:GeoCalcExtrapolationLatitude,degrees) (>L:Lat1,degrees)(@c:GeoCalcExtrapolationLongitude,degrees) (>L:Lon1,degrees)Then your string will read:Lat1 30.3333 Lon1 -50.0003) The inverse test that proves it all: in :30.00 (>@c:GeoCalcLatitude1,degrees)-50.00 (>@c:GeoCalcLongitude1,degrees)30.3333 (>@c:GeoCalcLatitude2,degrees)-50.00 (>@c:GeoCalcLongitude2,degrees)(@c:GeoCalcBearing,degrees) (>L:Bearing,degrees)(@c:GeoCalcDistance,nmiles) (>L: Distance,nmiles)And using a string like this:Dist %((L: Distance,nmiles))%!3.4f! Bear %( (L:Bearing,degrees))%!3.4f! You'll see 20.0001 (the length used in the first example) and 0.000 (Azimuth1 used) Rest is all yours! :-)SaludosTomPS: Don't forget C:fs9gps at the beginning of the gauge!.

Share this post


Link to post
Share on other sites

The following is a Geocalc test instrument I created in accordance with the above comments datedJul30 2007.It returns : Lat1 0.0000 Lon1 0.0000whereas it should return : Lat1 30.3333 Lon -50.0000I am obviously missing something or doing something incorrectly .Would appreciate advice or comments on the correct coding .Karol

<IMG name=zDATA_SCRN.bmp>C:fs9gpsC:fs9gps -   30.00(>@c:GeoCalcLatitude1, degrees) -50.00(>@c:GeoCalcLongitude1, degrees) 0(>@c:GeoCalcAzimuth1, degrees) 20(>@c:GeoCalcLength, NMiles) (@c:GeoCalcExtrapolationLatitude, degrees)(>L:Lat1,degrees) (@c:GeoCalcExtrapolationLongitude, degrees)(>L:Lon1,degrees)%Lat1%((L:Lat1,degrees))%!3.4f!\n%Lon1%((L:Lon1,degrees))%!3.4f!

Share this post


Link to post
Share on other sites

The code box appears to have stripped away most of the instrument detail .My structure was : Update hidden..No C:fs9gps Elementselectvalue30.00(>@c:GeoCalcLatitude1, degrees) -50.00(>@c:GeoCalcLongitude1, degrees) 0(>@c:GeoCalcAzimuth1, degrees) 20(>@c:GeoCalcLength, NMiles) (@c:GeoCalcExtrapolationLatitude, degrees)(>L:Lat1,degrees) (@c:GeoCalcExtrapolationLongitude, degrees)(>L:Lon1,degrees) Valueselectelement followed by an element containing the text %Lat1%((L:Lat1,degrees))%!3.4f!\n %Lon1%((L:Lon1,degrees))%!3.4f! Karol

Share this post


Link to post
Share on other sites

If it got "stripped out," then it could not have been formatted properly. The "code box" simply allows pure ASCII characters to be displayed without any embelishment or decoration.The only exception would be if you tried to copy/paste the XML from an IE display, in which case the leading dashes (-) will cause entries to disappear...Try opening the .xml script in Notepad, and then copy/paste into a "code box..." ;)

Share this post


Link to post
Share on other sites

Thank you ,will try with notepad .Karol

<IMG name=zDATA_SCRN.bmp>C:fs9gpsC:fs9gps   30.00(>@c:GeoCalcLatitude1, degrees) -50.00(>@c:GeoCalcLongitude1, degrees) 0(>@c:GeoCalcAzimuth1, degrees) 20(>@c:GeoCalcLength, NMiles) (@c:GeoCalcExtrapolationLatitude, degrees)(>L:Lat1,degrees) (@c:GeoCalcExtrapolationLongitude, degrees)(>L:Lon1,degrees)%Lat1%((L:Lat1,degrees))%!3.4f!\n%Lon1%((L:Lon1,degrees))%!3.4f!

Share this post


Link to post
Share on other sites

Did the same again , appeared in the codebox window with element,select ,value etcbut not in thread after I hit OK button ?Karol

Share this post


Link to post
Share on other sites