Retrieve weather station location from a GPS

159 views
Skip to first unread message

José Miguel Gonçalves

unread,
Apr 21, 2021, 8:32:15 PM4/21/21
to weewx-user

I'm using weewx in a custom mobile weather station (based on a Airmar device) which has a GPS device builtin.
I would like to set dynamically the weather station's Latitude/Longitude/Altitude in the weewx web page from the GPS device instead of the setting it statically from the configuration file.
Can anyone give me some pointers on best way(s) to achieve that?

vince

unread,
Apr 21, 2021, 9:59:02 PM4/21/21
to weewx-user
Read the lat/lon programmatically from the GPS, write a quick sed script to hack on weewx.conf accordingly, then reset weewx.

Tom Keffer

unread,
Apr 21, 2021, 10:07:32 PM4/21/21
to weewx-user
The latitude and longitude are first read from weewx.conf, but then they are held in an instance of weewx.station.StationInfo. Normally, this object is treated as readonly but, off hand, I don't see why you couldn't change the values.

You could write a custom service that reads the GPS, then changes the values there. Thereafter, the updated values would be used.

-tk

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/4395f0db-a7c5-4f6d-9a09-7a634690c075n%40googlegroups.com.

Garry A Lockyer

unread,
Apr 21, 2021, 10:18:54 PM4/21/21
to weewx...@googlegroups.com
A VERY quick look at the Airmar driver and docs on Airmar website suggests the weather station communicates via NMEA sentences.  If yes, they probably use the standard sentences for GPS position - can’t remember their names but they are well documented.

Anyway, you might be able modify the driver to parse NMEA sentences and write to the variable Tom K mentioned.

Regards,

Garry Lockyer
E: Ga...@Lockyer.ca


On Apr 21, 2021, at 19:07, Tom Keffer <tke...@gmail.com> wrote:



José Miguel Gonçalves

unread,
Apr 22, 2021, 4:45:11 AM4/22/21
to weewx-user
First of all, thank you all for your feedback.
Garry, I can not parse Lat/Long/Alt from the Airmar device because I'm using the 120WX model (that has no GPS builtin).
I've added an u-blox GPS module to provide location and use gpsd to retrieve it.
I will look into Tom's suggestion.

Best regards,
José Gonçalves

Greg Troxel

unread,
Apr 22, 2021, 7:39:35 AM4/22/21
to Garry A Lockyer, weewx...@googlegroups.com

Garry A Lockyer <garrya...@gmail.com> writes:

> A VERY quick look at the Airmar driver and docs on Airmar website
> suggests the weather station communicates via NMEA sentences. If yes,
> they probably use the standard sentences for GPS position - can’t
> remember their names but they are well documented.
>
> Anyway, you might be able modify the driver to parse NMEA sentences and write to the variable Tom K mentioned.

If it's NMEA, I would suggest putting those bits into gpsd and using
gpsd's interface to get location. Yes, you could reimplement an NMEA
parser, and tt's not really that complicated, but the gpsd code base is
the encapulstion of wisdom about dealing with data from GNSS receivers.
signature.asc

Tom Keffer

unread,
Apr 22, 2021, 8:37:44 AM4/22/21
to weewx-user, Garry A Lockyer
Check out weewx-nmea-xdr. It parses NMEA XDR sentences. It could probably be easily adapted.

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.

José Miguel Gonçalves

unread,
Apr 22, 2021, 9:34:26 AM4/22/21
to weewx-user
Tom, my issue is not with getting Lat/Long/Alt from the GPS device.
For that I'm not parsing NMEA, instead I'm using this Python interface to gpsd:


My issue is how I can pass the location info to WeeWX in a way that it can dynamically update the location information on the webpage.
You have told me that I could update 'weewx.station.StationInfo' for doing that, but, as I'm not a Python coder, I envision difficulties in doing that.
Can you please provide me some sample code on how to do that?
Reply all
Reply to author
Forward
0 new messages