Guest Fabrice Posted March 13, 2003 Report Posted March 13, 2003 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.
Pete Dowson Posted March 13, 2003 Report Posted March 13, 2003 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
cyberavia Posted March 15, 2003 Report Posted March 15, 2003 Bonjour Pete, Ok, thank's for your reply. If I found an basic algorithm to do that, I post to you or here. Au revoir, Fabrice.
jyoungken Posted May 28, 2003 Report Posted May 28, 2003 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now