Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>UPDATED ANSWER: I have just noticed some OTHER irregularities with Google's Weather API. In ANY case, you need to have 8 numerical digits, in addition to the negative sign, if it applies. See the following code block (Java-based) for proper formatting. (Not the perfect algorithm, but just a quick example so that you can see the results)</p> <pre><code>lat = lat.replace(".", ""); while(lat.length() &lt; 9) lat = lat.concat("0"); if(lat.contains("-")) lat = lat.substring(0, 9); else lat = lat.substring(0, 8); </code></pre> <p>ORIGINAL RESPONSE: Paul, the trick about Google's Weather API is that you don't use the coordinates as received by traditional latitude/longitude. Instead, you parse out the decimal points. Additionally, a "fun quirk" of Google's Weather API seems to be a requirement that the data come in as a 7- to 8-digit string. So, for instance, <code>45.</code>5 should really be <code>45.50000</code>, and <code>-73.583</code> should really be <code>-73.58300</code>. This length of 7-8 digits does NOT seem to include the negative sign (<code>-</code>) in front of any negative coordinates.</p> <p>So, your <code>45.5(0000)</code> becomes <code>4550000</code>, and your <code>-73.583(00)</code> becomes <code>-7358300</code>. So the final URL would be:</p> <pre><code>http://www.google.com/ig/api?weather=,,,4550000,-7358300 </code></pre> <p>Note that again, 7-8 digits means <code>4550000</code> or <code>45500000</code> would be acceptable, as would <code>-7358300</code> or <code>-73583000</code>.</p> <p>I only found out about the 7-8 digit length when I saw your question--I tried entering the data into my weather parsing program, and found that <code>455,-73583</code> does not yield proper data.</p> <p>Note that this is by my unofficial experimentation, and not by official documentation, so there may be other quirks to be discovered.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload