Board index FlightGear Development Weather

OpenWeatherMap local weather in FlightGear

Everything related to weather simulation, visuals should be discussed in the shader subforum.

OpenWeatherMap local weather in FlightGear

Postby lindoro » Mon Aug 03, 2020 11:50 am

Have you ever wanted to fly in a remote area of the world, far from any airport where no METAR is available? Take off from an aircraft carrier in the middle of the ocean experiencing the winds which are blowing there? Fly in the middle of a hurricane?

The answer is to fetch local weather data from a service like OpenWeatherMap (https://openweathermap.org/). One has to register to it (it's free) and get an API key and use this (although very basic) program I made https://github.com/gualtieromalde/owmread to do the work (every 10 seconds, get the position from FG, read the weather data, build a METAR message and access the FlightGear properties to write it). In the ReadMe there are all the info needed to run it along FG.

Any comments/questions/criticism are welcome! Have nice flights!
lindoro
 
Posts: 15
Joined: Thu May 07, 2020 6:22 pm

Re: OpenWeatherMap local weather in FlightGear

Postby benih » Sat Aug 08, 2020 2:50 pm

This sounds cool!
User avatar
benih
 
Posts: 1689
Joined: Tue Aug 15, 2017 10:34 am
Callsign: D-EBHX
Version: next
OS: Debian Linux 64bit

Re: OpenWeatherMap local weather in FlightGear

Postby wlbragg » Sat Aug 08, 2020 6:27 pm

Brilliant!

What exactly do you mean by "disable the Live weather"? It's a bit confusing because in the readme you then state "In FlightGear, select "Live data" in the Weather dialog."

This switch?
--disable-real-weather-fetch

I think I have it running correctly, how do I know I am getting it from the app an not the built in weather routines?
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7588
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: OpenWeatherMap local weather in FlightGear

Postby V12 » Sun Aug 09, 2020 8:16 am

Does OpenWeather provide wind aloft ?
Fly high, fly fast - fly Concorde !
V12
 
Posts: 2757
Joined: Thu Jan 12, 2017 5:27 pm
Location: LZIB
Callsign: BAWV12

Re: OpenWeatherMap local weather in FlightGear

Postby Lachlan Eggins » Sun Aug 09, 2020 9:43 am

Would be good to see if this gets added to FG on a release
Lachlan Eggins
 
Posts: 5
Joined: Thu May 07, 2020 6:38 am

Re: OpenWeatherMap local weather in FlightGear

Postby lindoro » Sun Aug 09, 2020 1:21 pm

wlbragg wrote in Sat Aug 08, 2020 6:27 pm:
What exactly do you mean by "disable the Live weather"?


Yes, sorry, it's a bit confusing. I was talking about the "real weather" checkbox in the FG starter. However I think that the "--disable-real-weather-fetch" should work. I'll update the readme on github.

wlbragg wrote in Sat Aug 08, 2020 6:27 pm:how do I know I am getting it from the app an not the built in weather routines?


you should see in the weather dialog that the METAR starts with XXXX 012345Z and not with the airport code and the time of the report. Or you can compare that string with the verbose output of the app. Or you can spawn in an area far from any airport (like Kerguelen island) and see if there is some weather activity.

Then,

V12 wrote in Sun Aug 09, 2020 8:16 am:Does OpenWeather provide wind aloft ?


Unfortunately not. I am still looking for a free API that provides this info. In that case, it shouldn't be difficult to add the feature to the code.

Finally,

Lachlan Eggins wrote in Sun Aug 09, 2020 9:43 am:Would be good to see if this gets added to FG on a release


I don't now. The fact is that every user would need to register to OpenWeatherMap and get a key...
lindoro
 
Posts: 15
Joined: Thu May 07, 2020 6:22 pm

Re: OpenWeatherMap local weather in FlightGear

Postby V12 » Sun Aug 09, 2020 9:51 pm

FG's Advanced Weather mode with Live METAR provide same functionality. If this software can't feed wind aloft data to the FG, IMHO it is waste time.
Fly high, fly fast - fly Concorde !
V12
 
Posts: 2757
Joined: Thu Jan 12, 2017 5:27 pm
Location: LZIB
Callsign: BAWV12

Re: OpenWeatherMap local weather in FlightGear

Postby lindoro » Mon Aug 10, 2020 12:31 am

Well, there's a difference. Live METAR does not work at all in airports in remote areas where METAR is not available (eg. ENJA) or where there isn't any airport. If you want to do a carrier landing far from the coast you can try with the real winds. Furthermore, you can explore local weather conditions such as hurricanes or storms, which are not captured by the METAR interpolation if they are far from airports.

Of course if you are flying Concorde at 50.000 ft between big, international airports live METAR is perfect (or even better, becase OpenWeatherMap gives only very basic info on cloud coverage). If you are landing an helicopter on a ship deck in the middle of the roaring forties, using live METAR you'll have no wind...
Last edited by Johan G on Mon Aug 10, 2020 2:03 am, edited 1 time in total.
Reason: Please do not quote the entire post directly above your's.
lindoro
 
Posts: 15
Joined: Thu May 07, 2020 6:22 pm

Re: OpenWeatherMap local weather in FlightGear

Postby V12 » Mon Aug 10, 2020 10:51 am

Sorry, in that case You are right.
Fly high, fly fast - fly Concorde !
V12
 
Posts: 2757
Joined: Thu Jan 12, 2017 5:27 pm
Location: LZIB
Callsign: BAWV12

Re: OpenWeatherMap local weather in FlightGear

Postby Spoty » Wed Sep 09, 2020 10:33 pm

Excuse my stupidity but I seriously dont get it. I dont even know which port to use...
Basically I dont understand anything :(
Spoty
 
Posts: 3
Joined: Sun Sep 06, 2020 5:18 am

Re: OpenWeatherMap local weather in FlightGear

Postby scarymovie » Wed Mar 31, 2021 11:51 am

Hi lindoro,

I believe to use it, I will need to compile the .c file after defining the api key and the httpd port?

Thank you.
scarymovie
 
Posts: 214
Joined: Wed Nov 21, 2007 3:34 pm
Location: Singapore

Re: OpenWeatherMap local weather in FlightGear

Postby lindoro » Wed Mar 31, 2021 12:34 pm

You can compile the code before doing anything; when you run it the first time it'll ask you for the port and the key (and store the key in a file). Run owmread --help to see all the options
lindoro
 
Posts: 15
Joined: Thu May 07, 2020 6:22 pm

Re: OpenWeatherMap local weather in FlightGear

Postby scarymovie » Thu Apr 01, 2021 3:43 pm

lindoro wrote in Wed Mar 31, 2021 12:34 pm:You can compile the code before doing anything; when you run it the first time it'll ask you for the port and the key (and store the key in a file). Run owmread --help to see all the options


It is a little harder to compile it in a MS Windows environment. Will need to find an alternative method.
scarymovie
 
Posts: 214
Joined: Wed Nov 21, 2007 3:34 pm
Location: Singapore

Re: OpenWeatherMap local weather in FlightGear

Postby lindoro » Sat Apr 03, 2021 3:49 pm

you can try in the WSL subsystem
lindoro
 
Posts: 15
Joined: Thu May 07, 2020 6:22 pm

Re: OpenWeatherMap local weather in FlightGear

Postby scarymovie » Tue Jun 29, 2021 6:56 pm

Hi lindoro,

I tried to compile on Ubuntu but encountered some issues. Seems like something is wrong with json. Any idea?

Code: Select all
owmread.C: In function ‘Weather getWeather(double, double, std::__cxx11::string)’:
owmread.C:98:22: warning: ‘Reader’ is deprecated: Use CharReader and CharReaderBuilder instead. [-Wdeprecated-declarations]
         Json::Reader jsonReader;
                      ^~~~~~~~~~
In file included from inc/json/json.h:11:0,
                 from owmread.C:2:
inc/json/reader.h:37:63: note: declared here
     "Use CharReader and CharReaderBuilder instead.") JSON_API Reader {
                                                               ^~~~~~
owmread.C:98:22: warning: ‘Json::Reader::Reader()’ is deprecated: Use CharReader and CharReaderBuilder instead [-Wdeprecated-declarations]
         Json::Reader jsonReader;
                      ^~~~~~~~~~
In file included from inc/json/json.h:11:0,
                 from owmread.C:2:
inc/json/reader.h:56:3: note: declared here
   Reader();
   ^~~~~~
owmread.C: In function ‘Coord readCoord(int)’:
owmread.C:239:18: warning: ‘Reader’ is deprecated: Use CharReader and CharReaderBuilder instead. [-Wdeprecated-declarations]
     Json::Reader jsonReaderLat;
                  ^~~~~~~~~~~~~
In file included from inc/json/json.h:11:0,
                 from owmread.C:2:
inc/json/reader.h:37:63: note: declared here
     "Use CharReader and CharReaderBuilder instead.") JSON_API Reader {
                                                               ^~~~~~
owmread.C:239:18: warning: ‘Json::Reader::Reader()’ is deprecated: Use CharReader and CharReaderBuilder instead [-Wdeprecated-declarations]
     Json::Reader jsonReaderLat;
                  ^~~~~~~~~~~~~
In file included from inc/json/json.h:11:0,
                 from owmread.C:2:
inc/json/reader.h:56:3: note: declared here
   Reader();
   ^~~~~~
owmread.C:257:18: warning: ‘Reader’ is deprecated: Use CharReader and CharReaderBuilder instead. [-Wdeprecated-declarations]
     Json::Reader jsonReaderLon;
                  ^~~~~~~~~~~~~
In file included from inc/json/json.h:11:0,
                 from owmread.C:2:
inc/json/reader.h:37:63: note: declared here
     "Use CharReader and CharReaderBuilder instead.") JSON_API Reader {
                                                               ^~~~~~
owmread.C:257:18: warning: ‘Json::Reader::Reader()’ is deprecated: Use CharReader and CharReaderBuilder instead [-Wdeprecated-declarations]
     Json::Reader jsonReaderLon;
                  ^~~~~~~~~~~~~
In file included from inc/json/json.h:11:0,
                 from owmread.C:2:
inc/json/reader.h:56:3: note: declared here
   Reader();
   ^~~~~~


Thank you in advanced. :)

Regards
scarymovie
 
Posts: 214
Joined: Wed Nov 21, 2007 3:34 pm
Location: Singapore

Next

Return to Weather

Who is online

Users browsing this forum: No registered users and 5 guests