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
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