Jump to content
The simFlight Network Forums
Sign in to follow this  
Guest Fabrice

Metar Station

Recommended Posts

Guest Fabrice

Hello,

How I can read the "METAR STATION" name in my program linked to FS2002 via FSUIPC.

I've read FSUIPC SDK documentation, but I've not found any offset can tell me witch "closest Metard Station" is near of plane position.

I've seen with ActiveSky it's possible to have this information (In main windows : Active Wx Station : XXXX [where XXXX is the ICAO code]) but perhaps this data is made by ActiveSky and not by FSUIPC ?

Thanks for your reply. and thank's to pete for your FSUIPC module.

NB : I'm one of the autors of FSUIPC French Documentation you can find in FSUIPC page on Enrico Web site.

Fabrice.

Share this post


Link to post
Share on other sites
Hello,

How I can read the "METAR STATION" name in my program linked to FS2002 via FSUIPC.

I've read FSUIPC SDK documentation, but I've not found any offset can tell me witch "closest Metard Station" is near of plane position.

I've seen with ActiveSky it's possible to have this information (In main windows : Active Wx Station : XXXX [where XXXX is the ICAO code]) but perhaps this data is made by ActiveSky and not by FSUIPC ?

Hi Fabrice,

It isn't available from FSUIPC generally. There is a complex and obscure way to get a best guess Metar station identity through the AWI (Advanced Weather Interface) of FSUIPC, for FS local downloaded weather only, but that isn't foolproof and can be misleading -- FS interpolates weather from three METAR stations in a triangulation system which isn't always easy to determine.

ActiveSky and FSMeteo of course actually feed the data from the METAR stations (which they know, as they are reading them) into FSUIPC -- FSMeteo uses the AWI, ActiveSky uses the FS98 system at present. But neither tell FSUIPC any of the METAR data itself. They are in fact controlling global weather, not local weather, in any case.

If you merely want to determine the nearest METAR station to a particular location, such as that of the aircraft, you can search through the ICAO POS.BIN file (in FS's Weather folder) and choose the entry closest to that position. The format is easy enough -- 16 bytes per entry: a 4 byte ICAO, then three 32-bit floats -- Latitude, Longitude, Elevation.

Regards,

Pete

Share this post


Link to post
Share on other sites

Here is a small vb.net function that will calculate the great circle distance between two points. input is in decimal degrees. it will return miles, kilometers, nautical miles.

Hope this is helpful.

Jim

Imports System

Imports Microsoft.Win32

Module UtilityRoutines

Function distance(ByVal lat1, ByVal lon1, ByVal lat2, ByVal lon2, ByVal unit)

'---------------------------------------------------------------------------

' this routine calculates the distance between two points (given the

' latitude/longitude of those points).

'

' definitions:

' south latitudes are negative, east longitudes are positive

'

' passed to function:

' lat1, lon1 = latitude and longitude of point 1 (in decimal degrees)

' lat2, lon2 = latitude and longitude of point 2 (in decimal degrees)

' unit = the unit you desire for results

' where: 'm' is statute miles (default)

' 'k' is kilometers

' 'n' is nautical miles

'---------------------------------------------------------------------------

Dim radlat1 As Double = Math.PI * (lat1 / 180)

Dim radlat2 As Double = Math.PI * (lat2 / 180)

Dim radlon1 As Double = Math.PI * (lon1 / 180)

Dim radlon2 As Double = Math.PI * (lon2 / 180)

Dim theta As Double = lon1 - lon2

Dim radtheta As Double = Math.PI * (theta / 180)

Dim dist As Double

dist = Math.Sin(radlat1) * Math.Sin(radlat2) + Math.Cos(radlat1) * Math.Cos(radlat2) * Math.Cos(radtheta)

dist = Math.Acos(dist)

dist = (dist * 180) / Math.PI

dist = (dist * 60) * 1.1515

Select Case LCase(unit)

Case "k"

dist = dist * 1.609344

Case "n"

dist = dist * 0.8684

End Select

Return dist

End Function

End Module

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • 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.