#Geo - Get Current Weather for User Location

Completed

Comments

13 comments

  • Official comment
    Avatar
    Permanently deleted user (Edited )

    Hi Folks,

    We have implemented this functionality on Android in the 8.9 release so users are able to call Get and Post functions using xmlhttp. https://iformbuilder.zendesk.com/hc/en-us/articles/360027972491-Android-Release-Notes-8-9

    Thanks!

    -Ben

    Comment actions Permalink
  • Avatar
    Will Anderson

    JACOB:
    Excellent and incredibly useful function - thanks for sharing! Just to note, there are a few very minor inconsistencies/errors in your example that people should be aware of to make sure they get it to work:
    1. They should double-check "my_location" vs. "mylocation" and "all_weather" vs. "allweather" after pasting the text as Dynamic Values or Conditional Values (whether or not their column name uses an underscore - it varies in the example text provided).
    2. Weather Station Elevation (ft) should reference column [8] not [7].
    3. There are a couple of hard-returns (empty lines) in the page-level script that should be deleted after pasting, otherwise the script won't run.

    We will definitely get some use out of this wonderful function - thanks again!
    Will

    0
    Comment actions Permalink
  • Avatar
    Will Anderson

    Jacob - Quick question. This is a fantastic function. Could you clarify when exactly the "current" weather data is captured when a GPS location is captured offline? Does it just grab the data when connection is regained, or when the device syncs? Or does it grab historical data (the weather when the device was offline an the GPS collected)? If it doesn't grab the older weather data - any ideas on how to tie it to when the GPS location was collected (either by using the date/time in the GPS data or some other way? Thanks a lot.
    Will

    0
    Comment actions Permalink
  • Avatar
    Jacob Shapley

    Hi Will,

    I absolutely agree. There were some issues with how the post was formatted (e.g., some underscores were removed when I posted). I have notified the iFormBuilder team and given them a clean copy to fix the post.

    Thanks for the heads-up!

    Jake

    1
    Comment actions Permalink
  • Avatar
    Jacob Shapley

    Hi Will,

    This example is currently set up to require an internet connection when the form is being filled out, as that is a requirement for some of the work our users are doing in the field.

    In cases where we do not need it real-time, we call NOAA's xml api for historic data, based on the user's occupied point and date-time stamp. We do some of this today. We generally make this call from our servers once the data is back inside our borders, so a slightly different workflow.

    1
    Comment actions Permalink
  • Avatar
    Will Anderson

    The underscores in my post were omitted too - that explains it! Let me know if you have any ideas on the NOAA (or other weather web services) historical data. I just realized the GPS location only collects time (not date) so another element (or metadata time/date) would need to be used...
    W

    0
    Comment actions Permalink
  • Avatar
    Will Anderson

    OK, thanks for the input on the historical data.
    W

    0
    Comment actions Permalink
  • Avatar
    Hamish

    Hi Jacob - looks great - Any thoughts why it doesn't work on Android - see discussion re this on this thread.

    https://iformbuilder.zendesk.com/hc/communities/public/questions/201465644-Prefill-Address-or-Street-using-Google-API

    1
    Comment actions Permalink
  • Avatar
    James

    Is their anyway to modify this for Australian weather stations? Ie Bureau of Meterology instead of NOAA?

    0
    Comment actions Permalink
  • Avatar
    Mark Hohn

    Has anyone got this to work on Android?

    0
    Comment actions Permalink
  • Avatar
    Penny Lau

    Hi Guys, I know this is a very late reply and we apologize, but for those folks who were struggling with making API calls work on Android, unfortunately Android JS library doesn't support XmlHttpRequest. Android JS is handled by Android webkit and you will be able to find all the classes supported: https://developer.android.com/reference/android/webkit/package-summary.html Let me know if you have any questions!

    Penny

    0
    Comment actions Permalink
  • Avatar
    Linda Smith

    Is the NOAA URL still active? I am not able to access it and not getting any data on the IForm. 

    Thank you! 
    Robert 

    0
    Comment actions Permalink
  • Avatar
    Tony Ruth

    Hi Robert, please make sure that you have line 34 from the snippet included in the page level JS, which includes a request header.

    https://gist.github.com/truth3/48a5117310a5ce1bc7c41ced27e77d0d

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk