• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FS2004 Custom Map Image in GPS?

Messages
38
Country
us-florida
Greetings,

I was wondering if there was a way to make a simple gps-type map gauge that would use a bmp of a vintage navigation map as a background? Top is always north and the image is static. Plotting the Azimuth1 and Length as well as the GeoCalcExtraPolationLatitude and GeoCalcExtraPolationLongitude are all that would be required. Maybe use an "X" symbol to represent the extrapolated point.

I'm trying to recreate pseudo-hyperbolic navigation for FS9. I realize that hyperbolic navigation is not possible (at least with my very limited knowledge of xml, anyway) in FS9, but a simple way of doing an azimuth and length from a known station would suite my purposes for now. The movement of the aircraft would be enough to simulate navigator error, hence not wanting to show the real gps position. The system would be based on LORAN-A chain stations, with the ability to plot two consecutive azimuths and lengths based on the station pair (one azimuth and length from each station).

The user could "plot" as many "fixes" as he/she would want, but I think I'm going to limit it to 3 or 4 total. The fixes, in reality, would be gps waypoints. As a result, I'm not sure if you can have more than one on the display. You can, however, have multiple "plots" saved for later callback.

I have different maps available to me at this point, and based on the excellent guide by Rob McElrath I realize that it is possible to have several maps to call from depending on the aircraft position.

I tried to search the forums for something along the lines, but he return keeps dropping "gps" and "map" from the search saying they are too short.

I haven't tried the code yet for the main gauge, but here is what I have. The code is based on an HFDF gauge who's author gave permission to modify. This would be a sole, update gauge from where the main GUI gauges (controller and map gauges) would get their input from. I would make as many "system" gauges as necessary - more for ease of access to data than for anything else. I'd rather have one for each "chain" than have to dig through miles of code for something. There is still much to add to this from the original code, but just wanted to know if I was on the right track.

Here is the code so far:

<Gauge Name="LORAN_SYS1a" Version="1.0">
<Update>

<!-- First Load and Station list -->
(L:Load1, bool) 0 ==
if{
<!-- U.S. East Coast Chain -->

<!-- Nantucket 1 -->
41.2498083333 (&gt; L:Lat_Nantucket, number)
-69.9723222222 (&gt; L:Lon_Nantucket, number)
1 (&gt; L:Sta_Type_Nantucket, number)
1 (&gt; L:Sta_Channel_Nantucket, number)
2 (&gt; L:pRR_Nantucket, number)
4 (&gt; L:Sta_Select_Nantucket, number)
124 (&gt; L:Sta_Pair_1H4, number)

<!-- Cape Hatteras 1 -->
35.2407833333 (&gt; L:Lat_Cape_Hatteras, number)
-75.5271916667 (&gt; L:Lon_Cape_Hatteras, number)
2 (&gt; L:Sta_Type_Cape_Hatteras, number)
1 (&gt; L:Sta_Channel_Cape_Hatteras, number)
2 (&gt; L:pRR_Cape_Hatteras, number)
4 (&gt; L:Sta_Select_Cape_Hatteras, number)
124 (&gt; L:Sta_Pair_1H4, number)

1 (&gt; L:Sta_Type_set, number)
1 (&gt; L:Sta_Channel_set, number)
1 (&gt; L:pRR_set, number)
1 (&gt; L:Sta_Select_set, number)
121 (&gt; L:Sta_Pair_set, number)
1 (&gt; L:Load1, bool)
}

(L:Load_counter_state, bool) 0 ==
if{
(L:Load_counter, number) 1 + (&gt; L:Load_counter, number)
0 (&gt; L:Wind_dir_rep, number)
0 (&gt; L:Wind_vel_rep, number)
0 (&gt; L:Magvar_rep, number)
}
(L:Load_counter, number) 200 ==
if{
1 (&gt; L:Load_counter_state, bool)
}

<!-- Station Pair Load -->

if{
1 (L:Sta_Channel_set, number) ==
2 (L:pRR_set, number) ==
4 (L:Sta_Select_set, number) == &amp; &amp;

124 (&gt; L:Sta_Pair_set, number)
}
if{
(Sta_Pair_set, number) (L:Sta_Pair_1H4, number) ==

(L:Lat_Nantucket, number) (&gt; C:fs9gps:GeoCalcLatitude1, degrees)
(L:Lon_Nantucket, number) (&gt; C:fs9gps:GeoCalcLongitude1, degrees)
(C:fs9gps:GeoCalcAzimuth1, degrees) (&gt; L:Bearing_01, number)
(C:fs9gps:GeoCalcLength, meters) 1852 / (&gt; L:Distance_01, number)

(C:fs9gps:GeoCalcExtraPolationLatitude, degrees) (&gt; L:Acft_Lat_01, number)
(C:fs9gps:GeoCalcExtraPolationLongitude, degrees) (&gt; L:Acft_Lon_01, number)

(L:Lat_Cape_Hatteras, number) (&gt; C:fs9gps:GeoCalcLatitude1, degrees)
(L:Lon_Cape_Hatteras, number) (&gt; C:fs9gps:GeoCalcLongitude1, degrees)
(C:fs9gps:GeoCalcAzimuth1, degrees) (&gt; L:Bearing_02, number)
(C:fs9gps:GeoCalcLength, meters) 1852 / (&gt; L:Distance_02, number)

(C:fs9gps:GeoCalcExtraPolationLatitude, degrees) (&gt; L:Acft_Lat_02, number)
(C:fs9gps:GeoCalcExtraPolationLongitude, degrees) (&gt; L:Acft_Lon_02, number)

(L:Sta_Pair_set, number) 124 ==
if{
(L:Acft_Lat_01, number) (&gt; L:MAP_01_Lat, number)
(L:Acft_Lon_01, number) (&gt; L:MAP_01_Lon, number)
(L:Acft_Lat_02, number) (&gt; L:MAP_02_Lat, number)
(L:Acft_Lon_02, number) (&gt; L:MAP_02_Lon, number)
}

</Update>
</Gauge>

Thanks in advance for any input. Oh, by the way, how to I get rid of the yellow thing laughing at me in the code? I don't see it anywhere else.

Thanks again,

Jorge
Miami, FL
 

tgibson

Resource contributor
Messages
11,338
Country
us-california
First, use the buttons across the top of the reply box to Insert/Code/Language = XML, and paste your code into that box. It will look like this.

XML:
<Gauge Name="LORAN_SYS1a" Version="1.0">
<Update>

<!-- First Load and Station list -->
(L:Load1, bool) 0 ==
if{
<!-- U.S. East Coast Chain -->

<!-- Nantucket 1 -->
41.2498083333 (&gt; L:Lat_Nantucket, number)
-69.9723222222 (&gt; L:Lon_Nantucket, number)
1 (&gt; L:Sta_Type_Nantucket, number)
1 (&gt; L:Sta_Channel_Nantucket, number)
2 (&gt; L:pRR_Nantucket, number)
4 (&gt; L:Sta_Select_Nantucket, number)
124 (&gt; L:Sta_Pair_1H4, number)

<!-- Cape Hatteras 1 -->
35.2407833333 (&gt; L:Lat_Cape_Hatteras, number)
-75.5271916667 (&gt; L:Lon_Cape_Hatteras, number)
2 (&gt; L:Sta_Type_Cape_Hatteras, number)
1 (&gt; L:Sta_Channel_Cape_Hatteras, number)
2 (&gt; L:pRR_Cape_Hatteras, number)
4 (&gt; L:Sta_Select_Cape_Hatteras, number)
124 (&gt; L:Sta_Pair_1H4, number)

1 (&gt; L:Sta_Type_set, number)
1 (&gt; L:Sta_Channel_set, number)
1 (&gt; L:pRR_set, number)
1 (&gt; L:Sta_Select_set, number)
121 (&gt; L:Sta_Pair_set, number)
1 (&gt; L:Load1, bool)
}

(L:Load_counter_state, bool) 0 ==
if{
(L:Load_counter, number) 1 + (&gt; L:Load_counter, number)
0 (&gt; L:Wind_dir_rep, number)
0 (&gt; L:Wind_vel_rep, number)
0 (&gt; L:Magvar_rep, number)
}
(L:Load_counter, number) 200 ==
if{
1 (&gt; L:Load_counter_state, bool)
}

<!-- Station Pair Load -->

if{
1 (L:Sta_Channel_set, number) ==
2 (L:pRR_set, number) ==
4 (L:Sta_Select_set, number) == &amp; &amp;

124 (&gt; L:Sta_Pair_set, number)
}
if{
(Sta_Pair_set, number) (L:Sta_Pair_1H4, number) ==

(L:Lat_Nantucket, number) (&gt; C:fs9gps:GeoCalcLatitude1, degrees)
(L:Lon_Nantucket, number) (&gt; C:fs9gps:GeoCalcLongitude1, degrees)
(C:fs9gps:GeoCalcAzimuth1, degrees) (&gt; L:Bearing_01, number)
(C:fs9gps:GeoCalcLength, meters) 1852 / (&gt; L:Distance_01, number)

(C:fs9gps:GeoCalcExtraPolationLatitude, degrees) (&gt; L:Acft_Lat_01, number)
(C:fs9gps:GeoCalcExtraPolationLongitude, degrees) (&gt; L:Acft_Lon_01, number)

(L:Lat_Cape_Hatteras, number) (&gt; C:fs9gps:GeoCalcLatitude1, degrees)
(L:Lon_Cape_Hatteras, number) (&gt; C:fs9gps:GeoCalcLongitude1, degrees)
(C:fs9gps:GeoCalcAzimuth1, degrees) (&gt; L:Bearing_02, number)
(C:fs9gps:GeoCalcLength, meters) 1852 / (&gt; L:Distance_02, number)

(C:fs9gps:GeoCalcExtraPolationLatitude, degrees) (&gt; L:Acft_Lat_02, number)
(C:fs9gps:GeoCalcExtraPolationLongitude, degrees) (&gt; L:Acft_Lon_02, number)

(L:Sta_Pair_set, number) 124 ==
if{
(L:Acft_Lat_01, number) (&gt; L:MAP_01_Lat, number)
(L:Acft_Lon_01, number) (&gt; L:MAP_01_Lon, number)
(L:Acft_Lat_02, number) (&gt; L:MAP_02_Lat, number)
(L:Acft_Lon_02, number) (&gt; L:MAP_02_Lon, number)
}

</Update>
</Gauge>

I don't really have any GPS coding experience of the type you need, but perhaps a suggestion. First, I don't think there is a need to create a set of L: variables for every station - that is a huge number. To conserve resources, why not set up a set of L: variables only for the current station pairs? Then when the user (or your code) selects a station pair, the data (which is fixed as numbers in the code) would be loaded into the L: variables only at that time.

Something like "if the station pair selected is Nantucket, then load the data into the Station L: variables". After that all code would be generic, manipulating the data that was loaded in earlier. No code duplication either. For example:

XML:
<!-- Nantucket 1 -->
(L:Station, string) 'Nantucket' scmp if{
41.2498083333 (&gt; L:Lat_Station, number)
-69.9723222222 (&gt; L:Lon_Station, number)
1 (&gt; L:Sta_Type_Station, number)
1 (&gt; L:Sta_Channel_Station, number)
2 (&gt; L:pRR_Station, number)
4 (&gt; L:Sta_Select_Station, number)
124 (&gt; L:Sta_Pair_Station, number)
}

This code would be repeated for each station.

Then code after that would manipulate these generic variables until the results are displayed on your map.
 
Messages
38
Country
us-florida
Tom,

Thanks for the quick reply. I understand where you're going with this, but it's backwards to what I'm trying to do. I'm not trying to get a station pair based on the station, but rather the individual stations from the station pair. The way the gauge is meant to work is as follows:

Knobs and switches are used to convey the station channel, station prr (purlse repeat rate), and station selection. Once those are set via knobs and switches, then the gauge calls up the info for one of two possible stations - either the master station or the slave/pair station it's related to. To this end, you have in the above example a station pair of 1H4 (from the LORAN history website) that you need to arrive at in order to get the stations of Nantucket and Cape Hatteras. I couldn't find a way to get this to work as a string for some reason (mixing numbers and letters), so I'm using the numbers 124 instead. More on that later.

You first power the unit to be able to work the switches and knobs ("visible" command to have the mouse areas available for use, otherwise you have a nice bmp file and nothing else). Then dial in "1" in the channel knob/switch, then flip the prr switch to "H" (interpreted as "2" by the gauge logic), and finally dial in "4" in the station knob/switch. This will (in theory) give you the station "pair" which will call up the information for the master and the slave stations.

Okay, now that you have the information available, you flip a switch for "M" (seen as "1" by the gauge) or "S" (seen as "2" by the gauge) to flip between the display of the master or slave station information in a notepad located on the gauge.

You now have access to lat/lon information available for each station. You use this info with the gps "math" function (GeoCalc) to store azimuth and length in yet another set of variables. These would be either 1 or 2 again based on the station selected. You finally convert the information from each of the azimuths and lengths (one at a time) to lat/lon numbers (again using GeoCalc) by using the extrapolation function of the GeoCalc. The resulting lat/lon information is in turn saved and displayed on another notepad. This is based on the aircraft position function on the HFDF gauge, just modified to work with two consecutive plots as opposed to a plot based on the actual aircraft position trying to find the station.

In the original concept of the gauge, you just bring up a bmp file of a map when you are done and try and figure where you are based on the notepad info. I figured that most people are using Google Earth anyway. Then I thought that being able to mark a location on a map "in-sim" would be a nice touch. No big deal if not possible, as long as I can get the other stuff to work as hoped.

As for the numbers for letters, I came up with this:

PRR: High, Low, or Slow are 1, 2, and 3 respectively
Master and Slave: 1 and 2 respectively

Right now I have a nice gauge with a lot of flipping and spinning, but not much else. I'm trying to implement an oscilloscope to represent signal strength of the station as well, but we'll see. I was thinking of using the "moving stick figure on the notepad" concept, but that's a lot of bmp files.

Thanks for the input on this, I really appreciate it. The original HFDF gauge was based on a bunch of data that you later called up, so I figured that would be the way to go. Is there a way to go the generic route with what I'm trying to accomplish?

Thanks for the input and hoping to get more!

Regards,

Jorge
Miami, FL
 

tgibson

Resource contributor
Messages
11,338
Country
us-california
Sorry, I don't understand your logic. You seem to be specifying things more than once (names, 1H4, 124, etc.). My best guess is that 1H4 = 124. If so, then when the user selects 1H4, then the resulting number is 124 and the code would load the data from Nantucket into a set of L:Station1 variables, and the Cape Hatteras data into a set of L:Station2 variables (or StationM and StationS variables?). Then the code after that would be generic using Station1 and Station2 variables.
 
Messages
495
Country
austria
Did just a short look!
it seems you have forgotten to write the 2 conditions

Code:
<!-- Station Pair Load -->

if{
1 (L:Sta_Channel_set, number) ==
2 (L:pRR_set, number) ==
4 (L:Sta_Select_set, number) == &amp; &amp;

124 (&gt; L:Sta_Pair_set, number)
}
if{
(Sta_Pair_set, number) (L:Sta_Pair_1H4, number) ==

(L:Lat_Nantucket, number) (&gt; C:fs9gps:GeoCalcLatitude1, degrees)
(L:Lon_Nantucket, number) (&gt; C:fs9gps:GeoCalcLongitude1, degrees)
(C:fs9gps:GeoCalcAzimuth1, degrees) (&gt; L:Bearing_01, number)
(C:fs9gps:GeoCalcLength, meters) 1852 / (&gt; L:Distance_01, number)
 
Messages
1,564
Country
thailand
Jorge,

Getting back to your original question, "I was wondering if there was a way to make a simple gps-type map gauge that would use a bmp of a vintage navigation map as a background?", the answer, as you have already concluded, is yes.

Here are a few points to keep in mind when writing XML that will place the "X" in the appropriate location on top of the vintage navigation map image:

- You will be using GeoCalc variables that are part of the gps.dll system, but you won't be using any part of the CustomDraw map system at all. I think you already know this, but I want to mention it anyway.

- This a what I call an "overlay" project in which you determine distance and bearing from a certain point or latitude and longitude relative to a certain point, and then calculate how many XML gauge 'pixels' x- and y-direction shift from the reference point to draw the "X". To solve this, you need to know the map scale, for example, how many XML gauge pixels are there per 100 feet of map image in both the x and y direction.

- Keep in mind that XML gauge pixels are not necessarily square. In fact, usually, they are not. There may be 100 gauge pixels per a certain map distance in the x direction, but maybe only, say, 80 gauge pixels for the same map distance in the y direction. On the other hand, it could be that there may be more y pixels for a certain distance, but the point is that they may not be the same for each axis.

- Your use of the GeoCalc variables to calculate extrapolated latitude and Longitude look correct. To determine the x- and y- gauge pixel shift necessary to position your "X", you can use GeoCalcAzimuth1 and GeoCalcLength and a bit of trig to calculate the shifts, or you could use GeoCalcExtrapolationLatitude and Longitude to calculate the shifts. Either way, you need to first know the map scale as above. I favor the lat/lon route rather than the azimuth/length route.

- There are some XML syntax errors in your code, including missing end brackets "}" and spaces between the &gt; and the variable name. Do yourself a favor and use the right caret symbol ">" instead of &gt; when you are writing a value to a variable. As an example, to store 15 into L:VAR, you would write it as 15 (>L:Var, number) rather than 15 (&gt;L:Var, number). You currently have it as (&gt; L:Var, number) with a space in front of L:Var. It won't work with that space.

- The yellow laughing faces - when posting code in this forum use the "Insert" menu feature in the menu bar at the top: the "..." menu item. Use the </> Code feature.

Bob
 
Messages
38
Country
us-florida
Bob,

Thanks for the reply. I was using the spaces and the "&gt;"since they were in the original code I was using as a basis for learning xml for gauges. I need to point out, this is a "beginner" project since the last few tries at other things didn't work out to well. I've only been seriously looking at xml for FS for only a few months.

I'll go and close all the spaces in the next scrub I do later tonight and try and run it again to see if it works. There are several changes that are going to be needed. I've gotten a lot of feedback from Tom and others and it seems I was going all wrong about the sine waves and "pairings" in the LORAN sense. I know it's not possible to do the hyperbolic stuff with my limited knowledge, but I'm still going to try and make something that is fairly "stripped down" from that.

I've made two gauges so far: one a "systems" gauge and the other the "interaction" gauge with the click spots, etc. Some things are not working, while others are. I haven't even tried the map - bmp or gauge - since I'm still struggling with getting something that works as far as the gauge. The scope will not be anywhere close to the real thing, but I'm hoping to have something that works. In reality you would go through several steps to get the thing to give a LOP. Here, I'm hoping to just have several switches and knobs that you turn or flip. Given the right "combination" you can "tune" a station that you then "plot" on the map. So far I've gottent the thing to plot on the gps, but it's been tough to just get it to do that. I still can't get the distance or azimuth even though the thing plots on the gps. Also, I can only go from one to the other. I can't "zero out" the values. I know I'm missing a "reset" command somewhere, but need to figure out "what" and "where" to place them first.

I'll work on this more tonight. One last question: From reading the book for the GPS I was under the impression I needed to do the Azimuth1 and Length calculation first in order to get the extrapolation later. Can you please explain what you mean by "lat/lon" vs "azimuth/length" route?

Thanks for the input and I'll post some more code later.

Regards,

Jorge
Miami, FL
 
Messages
1,564
Country
thailand
I was under the impression I needed to do the Azimuth1 and Length calculation first in order to get the extrapolation later Yes, that's correct, though I would refer to Azimuth1 and Length as input variables for the extrapolation calculation. Just semantics.

Can you please explain what you mean by "lat/lon" vs "azimuth/length" route? I wasn't making a very consequential point here.

You can plot the "X" position by shifting away from the reference location (which is the GeoCalcLatitude1, GeoCalcLongitude1 location) either using length and azimuth with appropriate sine and cosine trig and multiplying by map scale which is measured as map feet per gauge pixel in the x and y directions,

or by using GeoCalcExtrapolationLatitude, ExtrapolationLongitude differences compared to the reference lat/lon and shifting up the y axis using map scale measured as latitude degrees per y axis pixel and shifting along the x axis using scale measured as longitude degrees per gauge pixel.

Same thing. Six of one, half dozen of the other.

I won't weigh in on the xml code required to model hyperbolic navigation except to say that XML can handle the math involved and if you make appropriate assumptions I'm sure you can come up with something you like. Maybe your biggest challenge will be becoming proficient in the use of XML and its syntax requirements. One thing good is that you appear to be using FS9 XML schema and not FSX schema. Wise choice.

Good luck. You'll get there.

Bob
 
Last edited:
Top