Custom weather location solution (1 Viewer)

littlematt

Portal Pro
October 1, 2006
104
5
49
Home Country
New Zealand New Zealand
Living in a tiny wee town in South Otago I couldn't get MP2 to find my exact location, just the nearest city.
If you are in a similar situation, this might help you. I am suing WIN10 so location may differ....
Go to "C:\ProgramData\Team MediaPortal\MP2-Client\Config\<USERNAME>\"
Find the files "MediaPortal.UiComponents.Weather.Settings.WeatherSettings.xml"

edit in notepad, go to the line that looks like
"
<Name>Lawrence</Name>
<Id>2179825</Id>
<Detail>Lat. -45.91 Lon. 169.68</Detail>"

and change my details for yours.
There is also a file called "MediaPortal.UiComponents.Weather.Settings.WeatherSettings.bak" that I have changed in the same way, assuming it is a backup file in case the original goes missing/corrupted or whatever.
Not sure what the <id>xxxx</id> line means heh probably critical lol.
Job done =)
 

littlematt

Portal Pro
October 1, 2006
104
5
49
Home Country
New Zealand New Zealand
Okay so the <id> is for a city code as per openweathermaps API
Thinking MP2 would call the city code rather than the lat/long I deleted that line from the xml file.
Unfortunately my fears were confirmed now I dont get a forecast in MP2.
Is there a way of tweaking the xml file so it calls the lat/long coordinates rather than the city code?
 

HTPCSourcer

Retired Team Member
  • Premium Supporter
  • May 16, 2008
    11,418
    2,335
    Home Country
    Germany Germany
    Is there a way of tweaking the xml file so it calls the lat/long coordinates rather than the city code?
    It doesn't work this way. OpenWeatherMap requires the ID to deliver the corresponding weather data. Keep in mind that OpenWeatherMap uses (private) weather stations that submit data to the website.

    Now it's not that this information would really change if you moved 10 mi from location A to location B. So what you may want to do is to go to the OpenWatherMap website, allow Windows to use your location and then click on the "geo coords" (bottom-left). A map will appear that displays the OpenWeatherMap locations known in your area. Identify the closest spot to your place and either edit the MP2 setting file to use this ID or enter the chosen city name into the MP2 weather search field.

    owm1.JPG owm2.JPG
     

    littlematt

    Portal Pro
    October 1, 2006
    104
    5
    49
    Home Country
    New Zealand New Zealand
    Thanks for your reply. Unfortunately the closest location to us is Dunedin which is about 90kms away and has quite different weather to us being on the coast.
    Reading the openweather API description you can use coordinates only for weather data, without city code... As per here. Is there a way for MP2 to use this ability?
    Thanks again...
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    Lookup by coordinates should work by following format:
    upload_2017-12-6_20-31-25.png


    upload_2017-12-6_20-31-41.png


    upload_2017-12-6_20-37-35.png

    But I get results only randomly, no idea why it sometimes work and sometimes not. First seen results after I started Fiddler proxy to inspect what is going over wire.
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    I see there is also a way to load weather forecast also based on lat/lon coordinate. So this could be an alternative if the city selection provides not the wanted values.
     

    Lautenbaugh

    New Member
    December 16, 2017
    4
    0
    59
    Home Country
    United States of America United States of America
    I'm a newbie here and to MP2 (version 1.18.0.0). I can't enter any information-- either in the weather screen or in the settings for weather. I'm in Omaha, NE. Tried New York and London too-- it doesn't give me any option to select anything--nothing comes up. I tried just letting it use my location-- also failed.
     

    Lautenbaugh

    New Member
    December 16, 2017
    4
    0
    59
    Home Country
    United States of America United States of America
    And I tried changing the file above -- "MediaPortal.UiComponents.Weather.Settings.WeatherSettings.xml". But the text of it did not contain the lines pictured above-- for city code or lat/long.
     

    Users who are viewing this thread

    Top Bottom