Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi,

 

By far the easiest way is to use Version 3 of my DLL. I haven't released it because I haven't written the documentation yet, and I've had a few users testing it.

 

I've attached the latest to this post. It seems to be pretty stable now. Just overwrite your current DLL and XML files with the ones included in the zip. There are different version depending on what version of the .NET framework you are targeting (2 or 4).

 

To get the METAR for an ICAO use the following code:

            // 1. Get a reference to the weather services to save typing...
            // NOTE: Connection must already be open.
            WeatherServices ws = FSUIPCConnection.WeatherServices;

            // 2. Get METAR string at London, Heathrow
            string METAR = ws.GetMetarAtLocation("EGLL");

You don't need to call Process() when using the weather facilities, you get the results immediately.

 

The DLL has full Intellisense documentation, but if you need any more help let me know...

 

Paul

FSUIPCClient3.0_BETA.zip

  • Upvote 1
Posted

Hi,

 

By far the easiest way is to use Version 3 of my DLL. I haven't released it because I haven't written the documentation yet, and I've had a few users testing it.

 

I've attached the latest to this post. It seems to be pretty stable now. Just overwrite your current DLL and XML files with the ones included in the zip. There are different version depending on what version of the .NET framework you are targeting (2 or 4).

 

To get the METAR for an ICAO use the following code:

            // 1. Get a reference to the weather services to save typing...
            // NOTE: Connection must already be open.
            WeatherServices ws = FSUIPCConnection.WeatherServices;

            // 2. Get METAR string at London, Heathrow
            string METAR = ws.GetMetarAtLocation("EGLL");

You don't need to call Process() when using the weather facilities, you get the results immediately.

 

The DLL has full Intellisense documentation, but if you need any more help let me know...

 

Paul

Thank you very much Paul!

Posted

Hi,

I get this error:

 
"Error CS1729 'WeatherServices' does not contain a constructor that takes 0 arguments"
 
edit:
 
Now it works but in the metar message I get this and not a normal metar:
KFHR&A34 000000Z 00000KT&D0NG 27020KT&A1967NG 27025KT&A5967NG 100KM&B-482&D3048 1CU056&CU001FNMN000N 6CI392&CI001FNMN000N 15/05 Q1013 @@@ 66 15 270 20 | 197 15 270 25 | 
Posted

Is there a way to display a message in the fsx?

 

 

 

Yes, see offsets 3380 and 32FA. Make sure offset 3380 is declared before 32FA.

 

 

Now it works but in the metar message I get this and not a normal metar:
KFHR&A34 000000Z 00000KT&D0NG 27020KT&A1967NG 27025KT&A5967NG 100KM&B-482&D3048 1CU056&CU001FNMN000N 6CI392&CI001FNMN000N 15/05 Q1013 @@@ 66 15 270 20 | 197 15 270 25 | 

 

 

FSUIPC get this from SimConnect which uses a special format for FSX. If you want a more standard one you have two choices:

 

1. Create a new one by parsing the one above and pulling out the information you want.

 

2. Get back a full weather structure with:

 

FsWeather weather = ws.GetWeatherAtLocation("EGLL");

 

You'll then need to construct your METAR string by reading all the information in the weather structure.

 

Paul

Posted

Yes, see offsets 3380 and 32FA. Make sure offset 3380 is declared before 32FA.

 

 

FSUIPC get this from SimConnect which uses a special format for FSX. If you want a more standard one you have two choices:

 

1. Create a new one by parsing the one above and pulling out the information you want.

 

2. Get back a full weather structure with:

 

FsWeather weather = ws.GetWeatherAtLocation("EGLL");

 

You'll then need to construct your METAR string by reading all the information in the weather structure.

 

Paul

Thanks

 

How can I get winds information from a specific airport ?

Posted

 

How can I get winds information from a specific airport ?

 

Everything is in the FsWeather structure. The intellisense will tell you everything you need to know after you press the '.' key.

 

To get you started, here is a sample of stepping though each wind layer and getting the speed and direction:

            FsWeather weather = ws.GetWeatherAtLocation("EGLL");
            foreach (FsWindLayer wl in weather.WindLayers)
            {
                // get information from the wind layer e.g.
                Double direction = wl.Direction;
                Double speed = wl.SpeedKnots;
            }

Paul

  • Upvote 1
Posted (edited)

i use this system to get real metar. Is made to get two metars as same time, icao in "origen" and "destino"

Dim url1, url2 As String
        Dim posori1, posori2 As UInteger
        Dim posdes1, posdes2 As UInteger
        url1 = "http://www.aviationweather.gov/adds/metars/?station_ids="
        url2 = "&std_trans=standard&chk_metars=on&hoursStr=most+recent+only&submitmet=Submit"
        Dim metarorigen, metardestino As String
        metarorigen = New System.Net.WebClient().DownloadString(url1 + LCase(origen) + url2)
        metardestino = New System.Net.WebClient().DownloadString(url1 + LCase(destino) + url2)
        posori1 = metarorigen.IndexOf(">" + UCase(origen)) + 1
        Try
            posori2 = metarorigen.IndexOf("</FONT>") - 1
        Catch ex As Exception
            posori2 = 0
        End Try
        If posori2 > 0 Then txtMetarDep.Text = metarorigen.Substring(posori1, posori2 - posori1 + 1)
        posdes1 = metardestino.IndexOf(">" + UCase(destino)) + 1
        Try
            posdes2 = metardestino.IndexOf("</FONT>") - 1
        Catch ex As Exception
            posdes2 = 0
        End Try
        If posdes2 > 0 Then txtMetarArr.Text = metardestino.Substring(posdes1, posdes2 - posdes1 + 1)

Edited by vgmarimon
Posted

Everything is in the FsWeather structure. The intellisense will tell you everything you need to know after you press the '.' key.

 

To get you started, here is a sample of stepping though each wind layer and getting the speed and direction:

            FsWeather weather = ws.GetWeatherAtLocation("EGLL");
            foreach (FsWindLayer wl in weather.WindLayers)
            {
                // get information from the wind layer e.g.
                Double direction = wl.Direction;
                Double speed = wl.SpeedKnots;
            }

Paul

Thanks

Everything works

 

 

i use this system to get real metar. Is made to get two metars as same time, icao in "origen" and "destino"

Dim url1, url2 As String
        Dim posori1, posori2 As UInteger
        Dim posdes1, posdes2 As UInteger
        url1 = "http://www.aviationweather.gov/adds/metars/?station_ids="
        url2 = "&std_trans=standard&chk_metars=on&hoursStr=most+recent+only&submitmet=Submit"
        Dim metarorigen, metardestino As String
        metarorigen = New System.Net.WebClient().DownloadString(url1 + LCase(origen) + url2)
        metardestino = New System.Net.WebClient().DownloadString(url1 + LCase(destino) + url2)
        posori1 = metarorigen.IndexOf(">" + UCase(origen)) + 1
        Try
            posori2 = metarorigen.IndexOf("</FONT>") - 1
        Catch ex As Exception
            posori2 = 0
        End Try
        If posori2 > 0 Then txtMetarDep.Text = metarorigen.Substring(posori1, posori2 - posori1 + 1)
        posdes1 = metardestino.IndexOf(">" + UCase(destino)) + 1
        Try
            posdes2 = metardestino.IndexOf("</FONT>") - 1
        Catch ex As Exception
            posdes2 = 0
        End Try
        If posdes2 > 0 Then txtMetarArr.Text = metardestino.Substring(posdes1, posdes2 - posdes1 + 1)

I use c# not VB.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.