+ Reply
Page 1 of 3 123 LastLast
Results 1 to 20 of 53
  1. #1
    What's Jailbreak?
    Join Date
    Jan 2012
    Location
    USTN0229
    Posts
    18
    Thanks
    6
    Thanked 3 Times in 2 Posts

    Default GPS Based Weather Widgets

    Hey Guys,

    I been thinking about how to make Weather Widgets for themes "Live"(Based on your GPS Lat/Long). I found code out there from this website javascript - Access iPhone GPS coordinates - Stack Overflow

    Code

    navigator.geolocation.getCurrentPosition( function(loc){
    var lat = loc.coords.latitude;
    var lon = loc.coords.longitude;
    doSomethingWith( lat, lon ); // your function
    });
    Would there be any way to get the Var to use your GPS Location to fetch your location code from Yahoo! Weather to make weather widgets like the one I am using(Equix HD) use this?

    From my other post in the Equix thread

    But, could you make the code Var code in equix say fetch GPS location from device(iphone) fetch Location code Yahoo! Weather
    Last edited by tntgo; 01-09-2012 at 03:29 PM.

  2. The Following 2 Users Say Thank You to tntgo For This Useful Post:

    hispasat (01-13-2012), jjk454ss (02-22-2012)

  3. #2
    What's Jailbreak?
    Join Date
    Jan 2012
    Location
    USTN0229
    Posts
    18
    Thanks
    6
    Thanked 3 Times in 2 Posts

    I just want to say, I'm just getting into coding and learning, its taking me time to learn. If there is anyone who knows how to do this don't feel afraid to step on my toes and say so and let us all know how you did it. I though am more a concept person(more visual based).
    If it ain't broke, you haven't tried hard enough

  4. #3
    What's Jailbreak?
    Join Date
    Jan 2012
    Location
    USTN0229
    Posts
    18
    Thanks
    6
    Thanked 3 Times in 2 Posts

    I have heard of reverse geocoding, is that what needs to be part of the html code to pull the gps location for the widget? I'm think what would have to happen is that Widget would have to ask for the gps lat/long of the device, then it would somehow have to mix that with overlaying the location code that it parsed from Yahoo! Weather and spit that out in the form of the Town and temp and conditions like the equix widgets do.
    If it ain't broke, you haven't tried hard enough

  5. #4
    What's Jailbreak?
    Join Date
    Jan 2012
    Location
    USTN0229
    Posts
    18
    Thanks
    6
    Thanked 3 Times in 2 Posts

    Ok, so maybe I'm on the right track?

    This is my combined code so far, original code is from Equix theme

    // The location field should be a relatively machine-legible string

    // if using the default, Apple/AccuWeather parser (originally from Leopard's Weather.wdgt)

    var locale = "navigator.geolocation.getCurrentPosition( function(loc){
    var lat = loc.coords.latitude;
    var lon = loc.coords.longitude;
    api.geonames.org/findNearbyPostalCodes?;postalcode,country, radius (1.609344 Km), maxRows (default = 1)( lat, lon ); //
    });" //e.g. 'Defiance, Ohio'|'Moscow, Russia'|'Ledyard, AT'|'London, UK'
    I used the code from here for the GPS function

    javascript - Access iPhone GPS coordinates - Stack Overflow

    I used the code from here for the Postal code lookup function(and I edited the radius for 1 mile/1.609344 Kilometers) + I edited the field of postal code lookup rows from 5 to 1

    GeoNames Web Service Documentation

    I have no idea if I have the code setup right so far? Somehow still need to figure out how to use what postal code it looks up to parse the postal code using the gps function and the Geonames lookup system from the Yahoo! Extended Weather Forecast.

    Like I said, I have no idea if I have the code setup right(since I'm not very good at html coding). If anyone could let me know if I have it setup right + if someone knows how to parse the postal code field from the extended weather forecast on Yahoo! Weather

    Will that even work since the GPS function is java code and not html code. Is there something I need to change to make into HTML code?
    Last edited by tntgo; 01-10-2012 at 11:41 AM.
    If it ain't broke, you haven't tried hard enough

  6. #5
    Livin the iPhone Life KraXik's Avatar
    Join Date
    Mar 2011
    Location
    Winchester, UK
    Posts
    1,680
    Thanks
    1,307
    Thanked 951 Times in 523 Posts

    It might be worth giving Ian Nicoll and Dacal a PM. They are the undisputed champions of the weather widget. <br><br>Don't give up though!!!

  7. The Following User Says Thank You to KraXik For This Useful Post:

    tntgo (01-10-2012)

  8. #6
    What's Jailbreak?
    Join Date
    Jan 2012
    Location
    USTN0229
    Posts
    18
    Thanks
    6
    Thanked 3 Times in 2 Posts

    Quote Originally Posted by KraXik View Post
    It might be worth giving Ian Nicoll and Dacal a PM. They are the undisputed champions of the weather widget. <br><br>Don't give up though!!!
    I will do that, do you think its okay that I am using the code from these websites, since its just posted free on the internet I thought it would be ok to use?

    Also, how I find users and should we make this thread a sticky so it doesn't get crushed by all the other threads if no one posts in it?
    Last edited by tntgo; 01-10-2012 at 12:10 PM.
    If it ain't broke, you haven't tried hard enough

  9. #7
    Livin the iPhone Life KraXik's Avatar
    Join Date
    Mar 2011
    Location
    Winchester, UK
    Posts
    1,680
    Thanks
    1,307
    Thanked 951 Times in 523 Posts

    Quote Originally Posted by tntgo View Post
    I will do that, do you think its okay that I am using the code from these websites, since its just posted free on the internet I thought it would be ok to use?<br><br>Also, how I find users and should we make this thread a sticky so it doesn't get crushed by all the other threads if no one posts in it?
    <br><br>Just a note of credit is usually fine when borrowing free stuff on te Internet.<br><br>Search is kaput right now so the easiest way is just to use google. Maybe talk to a mod about sticky-ing the post. Pretty much every theme has a weather widget an everyone has to SSH their own code. Not having to do this would be amazing!<br><br>

  10. The Following User Says Thank You to KraXik For This Useful Post:

    tntgo (01-10-2012)

  11. #8
    What's Jailbreak?
    Join Date
    Jan 2012
    Location
    USTN0229
    Posts
    18
    Thanks
    6
    Thanked 3 Times in 2 Posts

    I sent Ian Nicoll and Dacal PM's hopefully they will respond

    If one of the mods can sticky this thread, I would appreciate it.
    Last edited by tntgo; 01-10-2012 at 01:26 PM.
    If it ain't broke, you haven't tried hard enough

  12. #9
    Green Apple
    Join Date
    Jan 2012
    Posts
    55
    Thanks
    28
    Thanked 196 Times in 35 Posts

    Hello Friends,
    I am very new to iPhone skinning/themes. And have been working for a few days to get the current location on the lockscreen that can be used by weather widget to display local weather without altering/entering location code. I have used similar geolocation javascript code in a HTML lock screen. But the code does not work on either Lockscreen.html or wallpaper.html. But it works fine when these files are launched in "iFile" and I can see the latitude and longitude displayed.

    The idea here is to get the WOEID for that location using latitude and longitude.

    Then I found out that this WOEID is also stored in the file "//var/mobile/Library/Preferences/com.apple.weather.plist" which is used by weather app.

    Local Weather info is stored under "<key>LocalWeather</key>" and WOEID for the current location is stored after this string. Search for the string <key>Woeid</key> after <key>LocalWeather</key>. This will give you the WOEID for that current location.

    Is there any way we can read this WOEID from "//var/mobile/Library/Preferences/com.apple.weather.plist" on the HTML lockscreen?

    Appreciate if I can get a help on this.

    Thanks.

  13. #10
    The Infamous Modder Raaj FX's Avatar
    Join Date
    Jun 2011
    Posts
    1,699
    Thanks
    136
    Thanked 1,707 Times in 798 Posts

    Blog Entries
    1
    Based on this

    1. Battery Drain
    2. Would constantly be refreshing itself inturn leading to no 1.

  14. #11
    Green Apple
    Join Date
    Jan 2012
    Posts
    55
    Thanks
    28
    Thanked 196 Times in 35 Posts

    You may set a refresh interval for this as all other HTML lockscreens do. But is there any way we can read this WOEID from "//var/mobile/Library/Preferences/com.apple.weather.plist" on the HTML lockscreen?

  15. #12
    The Infamous Modder Raaj FX's Avatar
    Join Date
    Jun 2011
    Posts
    1,699
    Thanks
    136
    Thanked 1,707 Times in 798 Posts

    Blog Entries
    1
    Quote Originally Posted by crazyvivek View Post
    You may set a refresh interval for this as all other HTML lockscreens do. But is there any way we can read this WOEID from "//var/mobile/Library/Preferences/com.apple.weather.plist" on the HTML lockscreen?
    Dreamboard reads your locale from your cache. Some that could work in a similar way.

  16. #13
    Livin the iPhone Life KraXik's Avatar
    Join Date
    Mar 2011
    Location
    Winchester, UK
    Posts
    1,680
    Thanks
    1,307
    Thanked 951 Times in 523 Posts

    Quote Originally Posted by Raaj FX View Post
    Based on this

    1. Battery Drain
    2. Would constantly be refreshing itself inturn leading to no 1.
    Of course the battery drain will be higher than if you didn't have it all, but I don't think it will be that high. It would take like a second for it to find your location. Then that's it. Maybe do that once an hour/30 min. That's not a whole deal. If some HighTechCrap can do it I'm pretty sure the iPhone can with little issue.

  17. #14
    What's Jailbreak?
    Join Date
    Jan 2012
    Location
    USTN0229
    Posts
    18
    Thanks
    6
    Thanked 3 Times in 2 Posts

    I'm so glad we have gotten interest in this project, unfortunately the computer I was using to SSH into my phone and work on code the power supply died last week, so I am using an old Mac-Mini but its slow and a pain to use, so I am thinking I am out of commission to work on anything with this for a while. But if anyone can figure this out that would be awesome.
    If it ain't broke, you haven't tried hard enough

  18. #15
    What's Jailbreak?
    Join Date
    Feb 2012
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    So, i too am interested in this and have been pursuing it for the last couple of days. What I have come up with so far is that I cannot get the geolocation to run when its called...

    When I do tests on my pc, I'm able to get my geolocation (of the pc, based on IP i assume) and then have it do a lookup at weather.com. When it does the lookup using my lat/long, i can return my weather code. Finally I can input that into the yahoo xml call for the weather, and it looks all good.

    But again, this is on my PC.

    When it comes to my iPhone, I can't get the geolocation to run from the main theme. It completely skips the function call. Without going into too much detail, here's what i have. Maybe someone can spot what i might have wrong:

    in the widget.html:
    <body onLoad="onLoad();">
    <div id="TextContainer"><a id="lat"></a><a id="lng"></a></div>
    </body>
    then in the javascript:

    function onLoad(){

    fetchLocation();

    ...
    }

    The only piece of importance is the fetchLocation function:

    function fetchLocation() {

    document.getElementById("lat").innerText = 1
    navigator.geolocation.getCurrentPosition(getLocati on,null);
    document.getElementById("lng").innerText = 2
    }

    function getLocation(position) {
    lat = position.coords.latitude;
    lng = position.coords.longitude;
    getLocId(lat,lng);
    }

    function getLocId (lat, lng){

    ... <secret sauce of the program> ...
    }

    so you can see that when the fetchLocation is first called, i'd be inputting 1 and 2 into lat and lng on the widget.html, but those aren't even being populated cause the function isn't running.

    So does the springboard html not allow location service calls?

  19. #16
    Green Apple
    Join Date
    Jan 2012
    Posts
    55
    Thanks
    28
    Thanked 196 Times in 35 Posts

    Does not seem to work on Lockscreen or wallpaper.html.

  20. #17
    What's Jailbreak?
    Join Date
    Feb 2012
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I was thinking about this more, and whenever the geolocation is used, there is always a popup window (javascript alert) that says would you like to use location services.

    Obviously that is not happening, and i think the code is just quitting right then and there.

  21. #18
    Livin the iPhone Life KraXik's Avatar
    Join Date
    Mar 2011
    Location
    Winchester, UK
    Posts
    1,680
    Thanks
    1,307
    Thanked 951 Times in 523 Posts

    Have you tried using it in perpagehtml app? It may work slightly different than winterboard.

  22. #19
    What's Jailbreak?
    Join Date
    Feb 2012
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I have, and didn't have any luck there either.

  23. #20
    What's Jailbreak?
    Join Date
    Oct 2011
    Posts
    5
    Thanks
    17
    Thanked 6 Times in 3 Posts

    I was thinking about what you want to do and it would be very nice.

    The question is how does the stock weather app generate the weather code for Yahoo LOCAL weather? Perhaps that is the path to follow.

    I am a coding NOOB but I found these which may or may not be helpful.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>OverrideLocation</key>
    <false/>
    <key>Location</key>
    <string>20852</string>
    ...

    OverrideLocation - Boolean setting for whether to use the Apple weather application settings or the settings in this file. Defaults to false, meaning use the Apple weather application. The first location from the Apple weather application will be used.

    Also please see the Yahoo Developer info.

    See:
    Yahoo! PlaceFinder Guide - YDN


    Yahoo PlaceFinder

    PlaceFinder recognizes a large number of place formats and returns rich geographic data about each result, including geographic coordinates, address components, and WOEID.
    See: Yahoo! PlaceFinder - YDN

    Yahoo! PlaceFinder is a REST Web service, accessible at the following URI:
    http://where.yahooapis.com/geocode?[parameters]
    The PlaceFinder Web service supports only the HTTP GET method. Other HTTP methods are not supported.
    The appid parameter and at least one location parameter are required for all requests. Reserved characters in the parameters must be URL-encoded. All text in the request must be UTF-8 encoded.
    See: Requests - YDN

    Latitude and Longitude

    Latitude and longitude can be specified for the location parameter. Latitude and longitude may be expressed as decimal degrees or degrees-minutes-seconds, with either leading or trailing directionals or leading signs. If directionals are provided, longitude may appear before latitude. If directionals are not provided, longitude may appear before latitude if it is outside the range -90 to 90. Otherwise, the latitude must appear first. Punctuation marks (commas, degrees, minutes, seconds) are ignored.
    Examples:
    50.3 -120.5
    50.3, -120.5
    -120.5 50.3
    50.3 N 120.5 W
    120.5 W 50.3 N
    50 18 0 -120 30 0
    50 18 0 N 120 30 0 W
    50° 18' 0" N 120° 30' 0" W
    Responses

    ...

    ELEMENTS

    The following tables describe the data elements in a response.

    ...

    woeid Integer Where On Earth ID for area. Returned if C flag is not set.
    See: Responses - YDN

    Request URI:

    *ttp://where.yahooapis.com/geocode?location=37.787082+-122.400929&gflags=R&appid=yourappid

    Response Data:

    <?xml version="1.0" encoding="UTF-8"?>
    <ResultSet version="1.0">
    <Error>0</Error>
    <ErrorMessage>No error</ErrorMessage>
    <Locale>us_US</Locale>
    <Quality>99</Quality>
    <Found>1</Found>
    <Result>
    <quality>99</quality>
    <latitude>37.787082</latitude>
    <longitude>-122.400929</longitude>
    <offsetlat>37.787082</offsetlat>
    <offsetlon>-122.400929</offsetlon>
    <radius>500</radius>
    <name>37.787082 -122.400929</name>
    <line1>655 Mission St</line1>
    <line2>San Francisco, CA 94105-4126</line2>
    <line3/>
    <line4>United States</line4>
    <house>655</house>
    <street>Mission St</street>
    <xstreet/>
    <unittype/>
    <unit/>
    <postal>94105-4126</postal>
    <neighborhood/>
    <city>San Francisco</city>
    <county>San Francisco County</county>
    <state>California</state>
    <country>United States</country>
    <countrycode>US</countrycode>
    <statecode>CA</statecode>
    <countycode/>
    <hash/>
    <woeid>12797156</woeid>
    <woetype>11</woetype>
    <uzip>94105</uzip>
    </Result>
    </ResultSet>
    Good Luck, we are all counting on you.
    Last edited by squawpeakguy; 02-02-2012 at 11:18 PM.

+ Reply
Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts