Page 444 of 613 FirstFirst ... 344394434442443444445446454494544 ... LastLast
Results 8,861 to 8,880 of 12259

Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.


Thread: UniAW7

  1. #8861
    Default Google Location Info - Tutorial Updated!
    OK folks, Google tutorial post updated. I highly recommend reading it again as the info is now coming from a more reliable place in the feed. Less likely to give you erros. Grant pointed this out to me and he is right! Also, just to be clear, I did not write any of the code for this location info work-around. Grant gave me his "ultimate location iwidget" (or whatever it's called) and I used that as base. He should be the one thanked for this, not me.

    So the tutorial now also shows how to get city, address, neighborhood and county. Of course, only if these things are available in the feed for your area. I recommend looking at the tutorial on a PC instead of a phone as there are some colour coded instructions and I'm not sure about everyone else but I don't see the colours when viewing on my phone.

    Here is a link to the updated tutorial. Good luck!

    http://modmyi.com/forums/iphone-6-th...ml#post7347243


    Edit: OK, here you go! Much easier to see all this code in action with a widget. This is the one I've been using...

    -img_0524.png

    All location info from Google.

    Download link: TimeCircuits WW2 with Google

  2. The Following 15 Users Say Thank You to Marty McFly For This Useful Post:

    #m37h{ (2016-01-22), A11AST3R (2016-01-23), Boots (2016-01-22), chevymusclecar (2016-01-25), Irish_Man (2016-01-23), King_O_Hill (2016-01-22), kristatos (2016-01-22), lostinthemes (2016-01-29), Max_Pa1n (2016-01-31), Mike2130 (2016-01-22), NewD (2016-01-22), nik1975 (2016-01-22), schalker44 (2016-01-23), signori (2016-01-22), Simon (2016-01-22)

  3. #8862
    Code Dependent NewD's Avatar
    Join Date
    Jan 2012
    Location
    Northeast US
    Posts
    5,708
    Thanks
    8,334
    Thanked 16,463 Times in 7,695 Posts

    Thanks for the shout out, Marty! To be fair I also need to credit Dacal for helping me figure out a couple of places I broke the code before it was finalized… lol!! He helps us all, doesn't he! And thank you also to Rasputin007 for giving me the original google API. It's always a team effort here! And I love that about this community and particularly about Ian's thread here!

  4. The Following 6 Users Say Thank You to NewD For This Useful Post:

    King_O_Hill (2016-01-22), kristatos (2016-01-22), lostinthemes (2016-01-29), Marty McFly (2016-01-22), nik1975 (2016-01-22), signori (2016-01-22)

  5. #8863
    Code Dependent NewD's Avatar
    Join Date
    Jan 2012
    Location
    Northeast US
    Posts
    5,708
    Thanks
    8,334
    Thanked 16,463 Times in 7,695 Posts

    I'll just be adding a couple of little updates to Marty's code to make sure you get the same "neighborhood" as we were used to getting in YahooPlaceFinder. His current call looking for administrative_area_level_3 won't really get us the neighborhood we had before. But give me an hour as I'm driving around and I'll post a little later!

  6. The Following 3 Users Say Thank You to NewD For This Useful Post:

    King_O_Hill (2016-01-22), Marty McFly (2016-01-22), signori (2016-01-22)

  7. #8864
    My iPhone is a Part of Me signori's Avatar
    Join Date
    Oct 2007
    Location
    Toronto
    Posts
    918
    Thanks
    689
    Thanked 758 Times in 397 Posts

    Quote Originally Posted by <Ian Nicoll/> View Post
    Sorry Signori I really must sleep now but to make life easy for helpers if any of you have an issue please state if you are using mine of Marty's code & in order for us to check it's better we get your coordinates from either the MyLocation.txt file or from the widgetweather.xml file (look for latitude & longitude).

    Sorry again.

    Gnight.
    Hey Ian. I am using Marty's updated code. I just can't figure out what code to add to get the , City after the Address. Thanks for the reply.

    Edit

    I think I got it. I added this + ", " + city; after Marty's code

    document.getElementById("Gaddress").innerHTML = stnumber + " " + address;

    So it looks like this now

    document.getElementById("Gaddress").innerHTML = stnumber + " " + address + ", " + city;

    That added the , City after my address. Thanks for the code New, Marty, Ian.
    Last edited by signori; 2016-01-22 at 07:18 PM.

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

    #m37h{ (2016-01-22), Marty McFly (2016-01-22)

  9. #8865
    Grant, because you can get neighbourhood from Google maps does not mean somebody in a different country will get that as well.
    Last year or so i was playing with this and had it all set up with splitting the results to get a perfect address info. But then I used some GPS coordinates from Germany and all went belly up.
    Each country has a different layout to the xml/json reply file you get from Google.
    That's why it is not advisable to put out code that splits reply data, it might work for you in the US, but it might not work for somebody outside the US.
    That's why I put up this site
    GPS data
    , so that everybody can go on it and see what all possible options there are. Then everybody can check to see how data is displayed in their country.
    For people that want to find additional info, they can use
    http://maps.googleapis.com/maps/api/...5&sensor=false
    replacing the latitude and longitude with their own. The resulting xml file in the browser window is the xml your widget will get.
    Crtl+A will select all text, copy and paste, so that you can look at it in your own time or save it as an xml file, watch out you don't include the line
    "This XML file does not appear to have any style information associated with it. The document tree is shown below."
    in your saved xml file.
    Now you can test at home and check if you get the right information.
    Nothing is impossible only miracles take a bit longer!

  10. The Following 3 Users Say Thank You to rasputin007 For This Useful Post:

    #m37h{ (2016-01-22), lostinthemes (2016-01-29), Marty McFly (2016-01-22)

  11. #8866
    Hi all
    Added marty's code to the main.js
    But then the all images and information disappears!!?
    For my LS via groovy lock

  12. #8867
    Quote Originally Posted by shamjosh View Post
    Hi all
    Added marty's code to the main.js
    But then the all images and information disappears!!?
    For my LS via groovy lock
    Did you add just the main.js code or did you follow the whole tutorial and edit the CSS and Html files as well?

  13. #8868
    My iPhone is a Part of Me signori's Avatar
    Join Date
    Oct 2007
    Location
    Toronto
    Posts
    918
    Thanks
    689
    Thanked 758 Times in 397 Posts

    Quote Originally Posted by Marty McFly View Post
    Did you add just the main.js code or did you follow the whole tutorial and edit the CSS and Html files as well?
    Hey Marty is it possible to get the province with this new Google code. Also is there away to have just Durham instead of Durham Regional Municipality. It's so long. Thanks.
    Last edited by signori; 2016-01-22 at 07:39 PM.

  14. The Following User Says Thank You to signori For This Useful Post:

    Marty McFly (2016-01-22)

  15. #8869
    Marty
    Followed all the steps as in the tutorial
    But when I revert to the original main.js
    All the elements information and images appear
    No city or TBD appears either as it has been removed by placing display none
    In the style.css file

    Thanks

  16. #8870
    Here's what is in the main.js file



    function dealWithWeather(obj) {



    var url2 = "file:///private/var/mobile/Documents/myLocation" + ".txt";

    jQuery.get(url2, function(appdata){

    var substr = appdata.split('\n

    var templatitude=substr[0].split('=');

    var templongitude=substr[1].split('=');

    var latitude = $.trim(templatitude[1]);

    var longitude = $.trim(templongitude[1]);

    obj.coords = latitude + "," + longitude;



    var Gurl ="http://maps.googleapis.com/maps/api/geocode/xml?latlng=" + obj.coords + "&sensor=false";

    jQuery.get(Gurl, function(data) {

    obj.type = [];

    obj.longname = [];



    var s=0;

    $(data).find('address_component').each( function() {

    obj.longname[s] = $(this).find('long_name').text();

    obj.type[s] = $(this).find('type').text();

    s++;



    });



    for (i=0; i < obj.type.length; i++) {

    if (obj.type[i].indexOf('street_number') != -1) { var stnumber = obj.longname[i]; break; } }



    for (i=0; i < obj.type.length; i++) {

    if (obj.type[i].indexOf('route') != -1) { var address = obj.longname[i]; break; } }



    for (i=0; i < obj.type.length; i++) {

    if ((obj.type[i].match('locality') ) && (!obj.type[i].match('sublocality') )) { var city = obj.longname[i]; break; } }



    for (i=0; i < obj.type.length; i++) {

    if (obj.type[i].indexOf('administrative_area_level_2') > -1) { var county = obj.longname[i]; break; } }



    for (i=0; i < obj.type.length; i++) {

    if (obj.type[i].indexOf('administrative_area_level_3') > -1) { var neighborhood = obj.longname[i]; break; } }



    document.getElementById("Gaddress").innerHTML = stnumber + " " + address;

    document.getElementById("Gcity").innerHTML = city;

    document.getElementById("Gneighborhood").innerHTML = neighborhood;

    document.getElementById("Gcounty").innerHTML = county;



    });



    });




    function dealWithWeather(obj) {



    var url2 = "file:///private/var/mobile/Documents/myLocation" + ".txt";

    jQuery.get(url2, function(appdata){

    var substr = appdata.split('\n

    var templatitude=substr[0].split('=');

    var templongitude=substr[1].split('=');

    var latitude = $.trim(templatitude[1]);

    var longitude = $.trim(templongitude[1]);

    obj.coords = latitude + "," + longitude;



    var Gurl ="http://maps.googleapis.com/maps/api/geocode/xml?latlng=" + obj.coords + "&sensor=false";

    jQuery.get(Gurl, function(data) {

    obj.type = [];

    obj.longname = [];



    var s=0;

    $(data).find('address_component').each( function() {

    obj.longname[s] = $(this).find('long_name').text();

    obj.type[s] = $(this).find('type').text();

    s++;



    });



    for (i=0; i < obj.type.length; i++) {

    if (obj.type[i].indexOf('street_number') != -1) { var stnumber = obj.longname[i]; break; } }



    for (i=0; i < obj.type.length; i++) {

    if (obj.type[i].indexOf('route') != -1) { var address = obj.longname[i]; break; } }



    for (i=0; i < obj.type.length; i++) {

    if ((obj.type[i].match('locality') ) && (!obj.type[i].match('sublocality') )) { var city = obj.longname[i]; break; } }



    for (i=0; i < obj.type.length; i++) {

    if (obj.type[i].indexOf('administrative_area_level_2') > -1) { var county = obj.longname[i]; break; } }



    for (i=0; i < obj.type.length; i++) {

    if (obj.type[i].indexOf('administrative_area_level_3') > -1) { var neighborhood = obj.longname[i]; break; } }



    document.getElementById("Gaddress").innerHTML = stnumber + " " + address;

    document.getElementById("Gcity").innerHTML = city;

    document.getElementById("Gneighborhood").innerHTML = neighborhood;

    document.getElementById("Gcounty").innerHTML = county;



    });



    });





    // DEFINE ALL UNITS



    if (Distance_In_Miles == true) {

    var convertD = 0.621371192;

    var visibilityunit = "mi.";

    var windspeedunit = "mph";

    } else {

    var convertD = 1;

    var visibilityunit = "km";

    var windspeedunit = "km/h";

    }

    if (Inches_Of_Mercury == true) {

    var convertP = 33.8638864;

    var pressureunit = "inHg";

    } else {

    var convertP = 1;

    var pressureunit = "mb";

    }

    if (obj.celsius == "YES") {

    var Unit = "C"

    } else {

    var Unit = "F"

    }

    if (Show_Degree == true) {

    if (ShowTempUnit == true) {

    var tempUnit = "&#176;" + Unit;

    } else {

    var tempUnit = "&#176;";

    }

    } else {

    if (ShowTempUnit == true) {

    var tempUnit = " " + Unit;

    } else {

    var tempUnit = "";

    }

    }
    if (Distance_In_Miles == true) {

    var convertD = 0.621371192;

    var visibilityunit = "mi.";

    var windspeedunit = "mph";

    } else {

    var convertD = 1;

    var visibilityunit = "km";

    var windspeedunit = "km/h";

    }

    if (Inches_Of_Mercury == true) {

    var convertP = 33.8638864;

    var pressureunit = "inHg";

    } else {

    var convertP = 1;

    var pressureunit = "mb";

    }

    if (obj.celsius == "YES") {

    var Unit = "C"

    } else {

    var Unit = "F"

    }

    if (Show_Degree == true) {

    if (ShowTempUnit == true) {

    var tempUnit = "&#176;" + Unit;

    } else {

    var tempUnit = "&#176;";

    }

    } else {

    if (ShowTempUnit == true) {

    var tempUnit = " " + Unit;

    } else {

    var tempUnit = "";

    }

    }

  17. #8871
    The bit with // DEFINE ALL UNITS
    was already present


    Ta

    PS
    Based in UK
    If that makes a difference

  18. #8872
    Thanks again Grant and Gary.

    Still trying to figure out why the neighborhood is showing as undefined.


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

    #m37h{ (2016-01-22), Marty McFly (2016-01-22)

  20. #8873
    Quote Originally Posted by shamjosh View Post
    The bit with // DEFINE ALL UNITS
    was already present


    Ta

    PS
    Based in UK
    If that makes a difference
    Zip up your widget and post a link if you can and I will take a look

  21. The Following 2 Users Say Thank You to Marty McFly For This Useful Post:

    #m37h{ (2016-01-22), Irish_Man (2016-01-23)

  22. #8874
    Quote Originally Posted by bliken View Post
    Thanks again Grant and Gary.

    Still trying to figure out why the neighborhood is showing as undefined.
    Grant mentioned earlier that I'm not using the best variable in the Google feed for neighborhood. I can only work with what I can see lol. The variable I used is what holds neighborhood for me (currently) but from what I can tell, results are different in Canada vs USA. Grant mentioned he would post his preferred way to get neighborhood later. That might be your ticket.

  23. The Following 4 Users Say Thank You to Marty McFly For This Useful Post:

    #m37h{ (2016-01-22), bliken (2016-01-22), Irish_Man (2016-01-23), NewD (2016-01-22)

  24. #8875
    Livin the iPhone Life nik1975's Avatar
    Join Date
    Feb 2008
    Location
    Thessaloniki, Greece
    Posts
    1,908
    Thanks
    4,509
    Thanked 1,485 Times in 879 Posts

    Also in my ls widgets o cant make them to work,i make the changes but them everything dissapears!!

  25. #8876
    Quote Originally Posted by signori View Post
    Hey Marty is it possible to get the province with this new Google code. Also is there away to have just Durham instead of Durham Regional Municipality. It's so long. Thanks.
    Yes and yes

    Province I will show you later (if Grant doesn't get to it first). For the Durham thing, in main.js change this line...

    document.getElementById("Gcounty").innerHTML = county;

    to this...

    document.getElementById("Gcounty").innerHTML = county.substr(0,county.indexOf(' '));

  26. The Following 2 Users Say Thank You to Marty McFly For This Useful Post:

    #m37h{ (2016-01-22), signori (2016-01-22)

  27. #8877
    Quote Originally Posted by nik1975 View Post
    Also in my ls widgets o cant make them to work,i make the changes but them everything dissapears!!
    You can't make it work with any widget? Post one up and I'll be happy to take a look.


    EDIT: Updated tutorial code again so "undefined" does not display if the fields in the Google feed happen to be blank.

  28. The Following 4 Users Say Thank You to Marty McFly For This Useful Post:

    #m37h{ (2016-01-22), Irish_Man (2016-01-23), nik1975 (2016-01-23), signori (2016-01-23)

  29. #8878
    Code Dependent NewD's Avatar
    Join Date
    Jan 2012
    Location
    Northeast US
    Posts
    5,708
    Thanks
    8,334
    Thanked 16,463 Times in 7,695 Posts

    Quote Originally Posted by rasputin007 View Post
    Grant, because you can get neighbourhood from Google maps does not mean somebody in a different country will get that as well.
    Last year or so i was playing with this and had it all set up with splitting the results to get a perfect address info. But then I used some GPS coordinates from Germany and all went belly up.
    Each country has a different layout to the xml/json reply file you get from Google.
    That's why it is not advisable to put out code that splits reply data, it might work for you in the US, but it might not work for somebody outside the US.
    That's why I put up this site
    GPS data
    , so that everybody can go on it and see what all possible options there are. Then everybody can check to see how data is displayed in their country.
    For people that want to find additional info, they can use
    http://maps.googleapis.com/maps/api/...5&sensor=false
    replacing the latitude and longitude with their own. The resulting xml file in the browser window is the xml your widget will get.
    Crtl+A will select all text, copy and paste, so that you can look at it in your own time or save it as an xml file, watch out you don't include the line
    "This XML file does not appear to have any style information associated with it. The document tree is shown below."
    in your saved xml file.
    Now you can test at home and check if you get the right information.
    I don't use the formatted address anymore with Google, Ras. I've moved on beyond that to the actual address ccomponents which are more predictable They work perfectly in US and Canada and are predictable in several ways. The code that I've created deciphers through stuff. But you're right Germany, Philippines.. all bets are off but no LESS predictable than what Yahoo would bring for neighborhood in other countries. That's the point.

  30. #8879
    Code Dependent NewD's Avatar
    Join Date
    Jan 2012
    Location
    Northeast US
    Posts
    5,708
    Thanks
    8,334
    Thanked 16,463 Times in 7,695 Posts

    I'll be able to get to some more of this tonight and tomorrow, guys. Got a snowstorm here that's gonna lock us in the house. There's a load of detail in the Google feed depending on where you are. You may just need to grab different parts of it. The method for looking at your area from your computer browser that Rasputin007 recently posted is a great way to discover what particular things you'd like to see in your widget. If you've done a little bit of coding it shouldn't be too hard to get what you want.

    I'm happy to help where I can. And thank you Marty and Ian for all your doing!

  31. #8880
    Quote Originally Posted by NewD View Post
    I'll be able to get to some more of this tonight and tomorrow, guys. Got a snowstorm here that's gonna lock us in the house. There's a load of detail in the Google feed depending on where you are. You may just need to grab different parts of it. The method for looking at your area from your computer browser that Rasputin007 recently posted is a great way to discover what particular things you'd like to see in your widget. If you've done a little bit of coding it shouldn't be too hard to get what you want.

    I'm happy to help where I can. And thank you Marty and Ian for all your doing!
    I'm in the eye of the storm. Blizzard in like an hour. Oh joy. Lol

Page 444 of 613 FirstFirst ... 344394434442443444445446454494544 ... 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
  •