Getting METAR weather through APRS

Looking on the APRS Google map one could see that there are not so many weather stations in Romania that hams could use.  Knowing that weather data could be gathered form the airports around the country, I decided to make possible that radioamateurs could use METAR weather information through APRS.

The idea is to make weather stations showing on the APRS map, presenting the METAR data. As one could see further down this article, not all METAR information could be sent through APRS but only the more interesting ones. The software will be presented and provided as open source package under GNU GPL license. The language used is C since the intention is to run the application on small, low power embedded Linux systems like home routers.

Couple of words about METAR, APRS and weather:

It seems to be gathering a large consensus that METAR come from french phrase:  message d’observation météorologique pour l’aviation régulière.

METAR is a way (one could say protocol) to convey weather information mainly for pilots use during pre-flight briefing. However, it is also used in other situations like moving weather data from one point to the other. It could contain many data fields that a pilot may be interested in like temperature, dew point, barometric pressure, visibility, wind speed and direction, runway visibility, etc.

APRS means Automatic Packet Reporting System and is a trademark of Bob Bruniga. It is a protocol able to convey various kind of information over AX25 protocol with primarily target being the radio networks.  Therefore APRS is a layer 3 OSI protocol over AX25 link layer. It uses AX25 somehow different in some details I will explain below.

Weather APRS message could include Latitude and Longitude, Wind direction/ Wind speed, Wind gusts speed, temperature, rain, last hour, rain last 24 hours, rain since midnight, humidity, barometric pressure.  Beside those information it could include a timestamp and possible some other arbitrarily message.

Looking at METAR and APRS weather messages one could see that some conversions are needed beside the fact that not all METAR information could fit in the APRS message. One example of such conversion is the wind speed which in METAR could be given in mph, knots, kmph but in APRS they should be given as mph.

Another mismatch between METAR and APRS is that METAR seems not to provide relative humidity (RH), therefore one need to calculate the RH from temperature and dew point. I used Magnus-Tetens formula to calculate RH and since it needs some floating point arithmetic it will need to be adapted when  running on embedded systems without hardware/software floating point.

The weather stations are identified using IDs given by different authorities. For example there could be ICAO (International Civil Aviation Organization) which is four letters ID (e.g. LROP) and WMO (World Meteorological Organization) which is a 5 digit number ID. Unfortunately, only weather data from stations having ICAO ID is provided on the NoAA servers (National Oceanic and Atmospheric Administration) in US. I would very much like to know how to access the data from stations listed only with WMO ID.

Being able to add text message to the normal APRS weather message made me add some more information from METAR like DEW point, prevail visibility and whether is CAVOK or not. CAVOK means Ceiling And Visibility OK.

How metarAPRS program works:

In short, the program accesses the NoAA ftp server, gets the latest METAR data from there, converts the relevant fields to APRS and sends it to the local PC Ax25 stack or directly to APRS-IS servers. When using the AX25 stack, the weather data could be output to a radio and when using APRS-IS servers connection, the data is fed directly to the servers through a TCP/IP connection.

A typical METAR message looks like:

date: 2010/10/31 14:30
METAR: LRBM 311430Z 00000KT CAVOK 14/02 Q1018

metarAPRS program has a configuration file ~/.metar-aprs/data.csv which needs to have listed all the station one needs to show on the APRS map. The ID (callsign in APRS parlance) of the station could be entered and also the position of the station needs to be added since it is not given by the METAR data. However, the position could be obtained by using following link:

A typical line in the configuration file looks like this:

LRBM-1, LRBM, 4740.00N/02335.00E – where LRBM-1 is the APRS callsign given to the station and LRBM is the ICAO ID for the station.

System configuration for metarAPRS:

If using a direct connection to one APRS-IS server, there is no need for an IGate. Just the proper command line options needs to be given. For example if one need to connect to the server, using password “1234” and callsign YO3IIU-10, the following command needs to be given:

metarAPRS -s -n 14580 -w 1234 -c YO3IIU-10

If want to use ax25 option in order to send the weather to a radio connected to your system, one needs to have an AX25 port configured. It is done by having axports (/etc/ax25/axports) filled in with the needed information (see man axports for details). For example, this is one line my axports file has:

sm0 YO3IIU 9600 256 7 144.800 APRS (9600 bps)

The port is sm0 and the callsign of the interface in this case is YO3IIU.

Now you need to initialize the port:

kissattach /dev/ttyS0 sm0

If all went smoothly you will see an interface called ax0 when listing existing interfaces on your system.

If you’ve already used soundmodem then you don’t need to do anything since the Ax25 is already configured.

Using an IGate:

One could use any IGate he/she has access to. I use aprsd but the most interesting application is XASTIR ( It is not an IGate “per se” but it has this functionality among other features I like at it.  One of the best features it has is the ability to use the OSM (Open Street Maps) – directly in it’s latest version from svn.

For XASTIR you need to configure one internet interface and one Ax25 TNC interface with sm0 as port.

Options for metarPRS:

I’ve added couple of command line options to the program and they could be seen in the help.

$ metarAPRS –help
Usage: metar-aprs [OPTONS]

-h –help                  help
-V –verbose          verbose
-v –version            version
-p –port                   port
-d –destination    destination (default IDENT)
-i –interval             interval (minutes)
-a –ax25                  use ax25 stack instead of direct connection
-s –server                APRS-IS server name
-n –server-port     APRS-IS server port
-w –pass                   APRS-IS server password
-c –callsign             callsign used for server login

Practical results:

Screen shot of one METAR weather station when using the direct server connection ( you could see the TCPIP*,qAS construct which means data comes from a direct connection):

Screen shot of the same METAR weather station when using Ax25 stack. The data now comes from a radio link (see the qAR construct):

After setting data file, configuring the Ax25 and the IGate, one will just need to run metarAPRS. Here are some screenshots with METAR weather stations showing on APRS map in both web browser and XASTIR:

Screenshot showing the wisibility data:

XASTIR screenshot with Open Street Map:

Things TODO:

– use other sources of weather data (what about WMO source or RSS feed?)

– find a way to show more data

– daemonize the application

Source code released as Open Source under GNU GPL license:

metarAPRS application sourcecode (v01): metarAPRS.tar.gz

metarAPRS application sourcecode (v02): metarAPRS_02.tar.gz

metarAPRS application sourcecode (v03): metarAPRS_03.tar.gz

14 thoughts on “Getting METAR weather through APRS

  1. Dear Bogdan,
    I found your metar-aprs converter, and I wanted to try it.
    To start the configure I get this error:
    checking /usr/include/metar.h usability… no
    checking /usr/include/metar.h presence… no
    checking for /usr/include/metar.h… no
    checking /usr/include/ftplib.h usability… yes
    checking /usr/include/ftplib.h presence… yes
    checking for /usr/include/ftplib.h… yes
    The make come up with this error too:
    src/metar-aprs.c:43:19: error: metar.h: No such file or directory
    src/metar-aprs.c: In function ‘metar_aprs’:
    src/metar-aprs.c:72: error: ‘Decoded_METAR’ undeclared (first use in this function)
    It seems me, on your machine there are somewhere this metar.h header file, but not included in the packages, you published.

    Another notes:
    Maybe, you can meke a notes to the future users, not to use your callsign, included in the program sources…
    best: Janos Tolgyesi

  2. Hi Janos,

    you need to install a package that adds metar decoding options. For Ubuntu it is called libmdsp-dev and for Fedora mdsplib. After you’ll install this package you will have metar.h and libmetar.a installed in your system.


  3. Hi, Bogdan,
    Thank you for your answer. I downloaded the lib-devel files, you mentioned, and I tired to compile the program.
    The compilation finished with two warnings, and I get the program metarAPRS. But when I started it, it send me only a Segmentation Falult error message, it seems, something isnot “compatible” on my system.

    By the way, in the last days I realized, that my amateur collegue, HA5DI Bela, solved this problem, related to the airports meteo-data, accessible in metar database, and related to our country.
    He wrote a python prog, to make this data available on aprs network to the hungarian aprs user community.
    I didnot see his program, maybe he dont want to make it accessible for the amateur community, but it hasnot too much importance around the hungarian amateurs, because he solved this job. I would like to look at only to see the solution, but for this I have your open source version.
    Thank you for this, I learned a lot from your experiments.
    Best wishes, have a Happy New Year!
    t.janos, hg5apz

  4. Dear Bogdan!
    My first “report” was a little “preliminary”: I downloaded the metar devel lib on my ubuntu, supposed it is “compatible” with the recent system.
    After this SegFalaut result, I tried to dig a little deaper into this problem. My everyday workhorse is a centos system. I downloaded the proposed mdsplib, it get it, installed it:
    Package mdsplib-0.11-9.el5.i386 installed,
    but after this the configure didnot find the metar.h file. I made a filesystem-wide search, it really nonexistent…
    After this I search the source of this package, found here:
    I downloaded and compiled it. It has a really nice demo, dmetar, it running whitout any problem.
    After I put the metar.h file in /usr/include, and the lib file in ./usr/lib.
    I rerun the configure in your source tree, and after I compiled the prog. It has success, but the runing prog produce only SegFalt on my centos too.
    I havenot enough practice in c programing, to search the rootes of this problem…. I write this here, hope, this will help you to improve your program.

  5. Dear Bogdan,
    I tired to trace my erros on my centos, it is a realy stupid error:
    I didnot used the “standard” install method, written in the metar library Makefile:

    install: library
    cp metar.h /usr/local/include/
    chmod 0644 /usr/local/include/metar.h
    cp libmetar.a /usr/local/lib/
    chmod 0644 /usr/local/lib/libmetar.a
    ranlib /usr/local/lib/libmetar.a

    instead of this I copied the metar.h and the libmetar.a files in the ./usr/.. space, without the enough permission to use.
    After I changed this permissions, the metarAPRS running, but it has some config error only:

    [root@centos5 metar]# ./metarAPRS -s -n 14580 -w 1234
    ma: ICAO number wrong format: Metar-APRS
    ma: parse datafile failed: #

    I hope, I will find the key to this trouble too..
    best: t.janos

  6. Hi Janos,

    Happy New Year to you too!

    I added the latest version of metarAPRS sources I have on my computer to the usual place on the blog. You may want to try this one.

    Glad to see you were able to run metarAPRS application. Installing of mdsp library should work out of the box, can’t understand what was the problem.

    Anyhow you need to get a password to access the APRS server(the one provided with -w option). 1234 is just an example and therefore you need to generate one for you. The best solution is to use the command callpass which comes with xastir. Its use is: callpass YOUR_CALLSIGN.

    Beside that, at first run of metarAPRS you’ll find a file in your home directory (.metar-aprs/data.csv) that will contain the weather stations you need to display on APRS map. You need to change that because it contains only one line.


  7. Hi, Dear Bogdan,
    thank you for your quick reply, and the quick mods in the source file.
    Thank you for the last proposed steps, it is very helpfull for me.
    I downloaded the new version of your code, I generate passw for the france aprs server, but it has some authentication problem.
    I realized, that in my test situation is better to use an own aprs server whitout any outside connection, because the metar data, available for our country are displayed on the aprs network.
    I set up an aprsd server, and try it to use, but it isnot clear how can configure it, if I want to use it with your program. In your program there is a login procedure, in this, your program wait a known ack sequence from the france aprs server, and from my server, ofcourse come out another.
    To make clear this problem, I put here the message, come from the login process of your program, try to make the connection with my aprsd server:

    [root@centos5 metar]# ./metarAPRS -s -n 14580 -w 24254 -c HG5APZ-10
    ma: wrong login ack: tstHG5APZ>APD225,TCPIP*:!4729.20NI01904.80E& aprsd 2.2.5 ver. server
    # Welcome to this test aprs server
    ��xF��݌ma: ma_aprs_init failed

    It seems, the first line is the netbacon txt, the second comes from the welcome message txt.
    Maybe I need to use another port? Or switch off this bacon message?
    best wishes:

  8. Hi, Dear Bogdan!

    It seems, it is a slow, long walk for me to test this setup, with your metar data program, because my basic knowledge in this fields.

    I looked into your code, and found the condition on the login process, waiting for ack from the server. I chenged at my aprsd bacon it, and started the prog with -V option. It seems, all are ok, but the data canot arrive to the map, visible on the xastir.
    Here is the trace log of this call:

    [root@centos5 metar]# ./metarAPRS -V -s -n 14580 -w 24254 -c HG5APZ-1
    ma: connecting to pass:24254
    ma: server IP address:
    ma: connected to APRS-IS server:
    ma: got connect ack from APRS-IS server: # aprsd 2.2.5-13 Oct 2002 aprsd group
    ma: sending login to server: user HG5APZ-1 pass 24254 vers APXB 02 filter m/1
    ma: Reading data file …
    ma: got new entry in data file:
    ma: callsign: HG5APZ-1
    ma: ICAO: LHBP
    ma: position: 4716.00N/01916.00E
    ma: remote_path: /data/observations/metar/stations/LHBP.TXT
    ma: date: 2011/01/03 10:30
    ma: METAR: LHBP 031030Z 35004KT 1400 R31L/0600VP1500U R31R/P1500N BR BKN002 OVC005 M04/M05 Q1021 NOSIG


    WIND SPEED : 4
    PREVAIL VSBY (M) : 1400.000000
    CLOUD HGT (CHARAC.) : 002
    CLOUD HGT (CHARAC.) : 005
    CLOUD HGT (METERS) : 150
    TEMP. (CELSIUS) : -4
    D.P. TEMP. (CELSIUS): -5

    ma: APRS message: !4716.00N/01916.00E_350/004g…t025r…p…P…h92b10210xBCD- DEW -5C Visibility 1400m Cloud BKN 60m
    ma: APRS-IS message: HG5APZ-1 >APXB02,TCPIP*:!4716.00N/01916.00E_350/004g…t025r…p…P…h92b10210xBCD- DEW -5C Visibility 1400m Cloud BKN 60m

    Here waiting the prog whitout any more steps …..
    Are in this record some mistakes? Or does the program wait for another ack??? or something else?
    Really sorry for inconveniences,
    best for you:

  9. Hi Janos,

    The messages you presented are ok but I think the problem is in aprsd which does not relay the messages to APRS-IS servers. Anyway, the way you are trying to use aprsd is unusual and I presume it won’t work directly.

    The way I used aprsd as an IGate is to configure metarAPRS to sent the messages to linux ax25 stack (see in blog how to configure it) and then let aprsd get the messages from ax25 linux stack and send it to APRS-IS servers (on internet) or let xastir see the messages directly through an ax25 interface.

    So, the ideea is to configure ax25 stack, one indication being that you’ll have a new network interface created called sm0 or ax0 (you can see it with ifconfig). Before doing that you need to install everything related to ax25 in your distribution.Then create a new interface of type ax25 in xastir. Now metarAPRS need to be lunched only with -a ax0 or sm0 and no server and password since it connects to the local ax25 stack only. If you do not want to send your data to internet then no aprsd is necessary.

    If you do this complicated procedure :) you’ll learn how ax25/aprs protocols are working and how the tools associated (axlisten, beacon, etc) are to be used and in general will get a lot of knowledge about packet radio.

    But, just to see the weather station shown on the internet map you could try to run metarAPRS on a real APRS-IS server, changing the coordinates of the weather station(in config file) so that they match a place (for example your place) so that nobody will get harmed.


  10. Dear Bogdan,
    You are totally right, when you propose me to setup a “real” (native(?)) aprs site with ax25 port and live radio and real traffic. But in this moment I dont plan to make this. I found your solution about this topic, how can convert the metar data records to aprs packets, acceptable for the aprs network/servers, and I was interesting to look into this solution.
    I am really sory for my poor programing practice, and because this I send you many unwanted/boring lines, inserted here.
    You are right, to use a minimal aprs setup on the internet, and more exactly on a small local network segment, it is a funny playing only. But in this monent this is, what I need to study your solution.

    So: many thanks, first of all for your nice and compact porgram,
    many thanks for your patientes, to answer my questions, notes,
    and many thanks for your proposed directions for me.

    Now your program working fine on my simple testbed.
    If you compare the folloving two log messages, you will see, what was the root of my last problem: not to send out to the net the assembled packets.
    The problem is an unwanted space only, in the APRS-IS message. In the original assembled packet there is a space between the callsign and the following > character.
    If I removed this space from the 596.-th line of the source, all the aprs packets come up on my xastir test page.
    I attach here this lines too.

    Thank you, and best wishes: t.janos


    dont working:
    ma: APRS message: !4722.00N/01926.00E_…/003g…t025r…p…P…h92b10220xBCD- DEW -5C Visibility 1500m Cloud OVC 30m
    ma: APRS-IS message: HG5APZ-10 >APXB02,TCPIP*:!4722.00N/01926.00E_…/003g…t025r…p…P…h92b10220xBCD- DEW -5C Visibility 1500m Cloud OVC 30m

    ma: APRS message: !4722.00N/01926.00E_…/003g…t025r…p…P…h92b10220xBCD- DEW -5C Visibility 1500m Cloud OVC 30m
    ma: APRS-IS message: HG5APZ-10>APXB02,TCPIP*:!4722.00N/01926.00E_…/003g…t025r…p…P…h92b10220xBCD- DEW -5C Visibility 1500m Cloud OVC 30m

    596: orig:
    sprintf(tbuf, “%s >%s%s,TCPIP*:%s”, call, MA_VERL, MA_VERN, ibuf);
    the space removed:
    sprintf(tbuf, “%s>%s%s,TCPIP*:%s”, call, MA_VERL, MA_VERN, ibuf);

  11. Hi Janos,

    thanks for your time used to debug metarAPRS code, your help is very much appreciated.
    I remember this space character that I entered in the message because xastir was doing so and I was not so sure it is allowed by the standard or not. Seems the APRS-IS servers do not care about it but aprsd does. I just need to confirm the setup that works for you and the changes you’ve done. Could you elaborate a bit for me the command line you are using lately with metarAPRS and what are the setting in xastir interface?
    What version of aprsd are you using? I need to verify the wrong acknowledge issue.


  12. Dear Bogdan,
    I used the more simple setup.
    The aprsd and the xastir running on a newly installed fress ubuntu (10.10).
    The local ip address of this machine is
    I installed with the apt-get the 2 components, the aprsd daemon, its version is:

    aprsd version:

    and the xastir client, its version is (not the latest):

    xastir version

    I “killed” all the references in the aprsd.conf file to the network servers, I modified the server callsign, started with #, because I found in your prog, it check this char.

    servercall #stHG5APZ
    MyCall HG5APZ-10
    In INIT.TNC I changed mycall to HG5APZ-10 too

    In the xastir I set up some server interface ports, but didnot use it.
    I defined an network interface for this test setup, with this data:
    Passcode [the generated code]
    Port 10151 (but I think, it works on another port too.)
    Filter r/47/17/100 (for my area)
    I use to compile and run your program on my another machine with centos linux.
    Its ip address is:

    I used this command line to make connection, and try to insert the generated metar record:

    [root@centos5 metar]# ./metarAPRS -V -s -n 10151 -w 24254 -c HG5APZ-1
    For test I used the main hungarian airports ID, LHBP at noaa ftp site.

    Thats all, I am happy If I can help to you…
    best: t.janos

  13. Hi Janos,

    thanks for explaining in such details what you have done.
    I spent some time to investigate the same setup and it seems aprsd is not sending the right acknowledge at login. This is probably because it has never been updated from 2002. Indeed it works on main port 10151 but not on others.
    Anyway, it is good that you found a working solution for you and that really proves the power of open source.
    I will probably release another version containing the change with the character space.


  14. Hi Bogdan,
    I spent a little more time with your metar-aprs gate sw, and I compiled it on NSLU2, under debian. It runing fine with my simple test setup:
    The metarAPRS running on NSLU2, get the metar data from noaa server, convert the data to aprs packet, and send it to the (old) aprsd, running on the desktop ubuntu, with the xastir “interface”.
    By the way, I studied your another cool, very cool projects too. Connecting to your asterisk project, I wuld like to ask from you some help, about a “dead” ASUS WL500, I will send you a private message about this later.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>