Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
set location with google-map format entry
#1
Hi Dan,

It is a bit of an effort on a mobile phone to reformat google-map location data ("lat,lon") for the location settings in weather_level_adj plugin.

So here a snippet to do so -- at line number 366 of SIP/plugins/weather_level_adj.py I add:

        # allow for google map loc format (lat, lon)
        loc = lwa_options[u"loc"]
        q_contain_letters = loc.lower().islower() # city name would contain some letters
        if not(q_contain_letters) and (", " in loc):
            lat, lon = loc.split(", ") # assume google map location format: loc="lat, lon"
            lat, lon = map(lambda s: str(round(float(s),4)), [lat, lon]) # keep only 4 decimal places
            loc = "lat="+lat+"_lon="+lon
            lwa_options[u"loc"] = loc

The data will be saved in the original SIP format, "lat=x.xxx_lon=y.yyy", but one can now copy and paste "lat,lon" from google-map drop-pin.

Of course, the original "city name" and SIP formats still work.

Hope it makes setting up SIP a bit easier.

Paul
Reply
#2
Thanks Paul,

User contributions are always welcome. I have added your update to the weather plugin on GitHub.

The SIP project has been improved to a large extent by contributions like yours.

Dan
<p><br></p>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)