{"id":751,"date":"2025-10-24T12:02:52","date_gmt":"2025-10-24T16:02:52","guid":{"rendered":"https:\/\/scootercam.net\/notes\/?p=751"},"modified":"2025-10-24T12:12:46","modified_gmt":"2025-10-24T16:12:46","slug":"scootercam-the-big-picture","status":"publish","type":"post","link":"https:\/\/scootercam.net\/blog\/scootercam-the-big-picture\/","title":{"rendered":"Scootercam &#8211; the Big Picture"},"content":{"rendered":"\n<p>Scootercam is a weather station website with webcams. It started out as a hobby but has outgrown its sandbox, and is on its way to a sustainable future as a set of easily-maintained WordPress plugins. Each plugin does something specific, and we&#8217;ll dive into each of them later. First though is the view from 30,000 feet &#8211; the big picture, how data and images come together on the world&#8217;s most important website.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Weather data<\/h2>\n\n\n\n<p>There are two ways Scootercam gets weather data &#8211; like the current temp, or tomorrow&#8217;s chance of rain: <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Home weather stations connected to the internet. These could include the LaCrosse weather station or the home-built units I&#8217;ve added. They&#8217;re usually limited to temperature, humidity, wind speed and direction, and barometric pressure. They take periodic readings and send the data <em>somewhere<\/em>, which may be an app, &#8220;the cloud,&#8221; or a website like Scootercam that&#8217;s been set up to receive the data. <\/li>\n\n\n\n<li>&#8220;Data aggregators&#8221; (we use Visual Crossing) pull weather data from dozens of sources and use computer models to create hyperlocal forecasts. The result is a huge dataset that&#8217;s updated and downloaded every few minutes. Scripts on Scootercam handle it, and some of that&#8217;s why we&#8217;re here today. <\/li>\n<\/ul>\n\n\n\n<p>The data we get from Visual Crossing is essential for Scootercam&#8217;s 24-hour and 7-day forecasts, and for example, for selecting which icon or emoji is shown where (we get moon phase data from another source). There are several new Scootercam WordPress plugins that handle how the data is presented. We&#8217;ll get to those later. First, a look at how it gets here &#8211; the <strong>Scootercam Weather and Moon Phase Updater.<\/strong><\/p>\n\n\n\n<p>This plugin should be able to run without intervention, but knowing what it&#8217;s doing will help if there&#8217;s any need for problem solving. It manages the queries made to Visual Crossing and Moon API, receives the data, and then sorts the giant output files into much smaller, more useable chunks. Other plugins use the chunks to make forecast tables. Here&#8217;s how the <strong>Scootercam Weather and Moon Phase Updater<\/strong> works.<\/p>\n\n\n\n<p>In simplest terms, the plugin ties in with an external service to send a scheduled message back to Scootercam &#8211; every 5 minutes for Visual Crossing weather data, every hour for moon data. Let&#8217;s start with Visual Crossing.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Visual Crossing Weather API &#8211; Query Examples<\/h1>\n\n\n\n<p><strong>Understanding your weather API queries<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udccd Your Current Query<\/h2>\n\n\n\n<p>This is what Scootercam&#8217;s <code>api-get-viscross.php<\/code> script sends to Visual Crossing:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;weather.visualcrossing.com\/VisualCrossingWebServices\/rest\/services\/timeline\/42.5590784,-86.228992?unitGroup=us&amp;elements=temp,humidity,windspeed,winddir,aqius,precipprob,conditions,icon,datetime,tempmax,tempmin,preciptype,sunrise,sunset,description,visibility,uvindex,cloudcover,severerisk,pressure,dew&amp;include=current,hours,days,alerts&amp;key=YOUR_API_KEY\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Breaking It Down:<\/h3>\n\n\n\n<p><strong>Base URL:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;weather.visualcrossing.com\/VisualCrossingWebServices\/rest\/services\/timeline\/\n<\/code><\/pre>\n\n\n\n<p><strong>Location:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>42.5590784,-86.228992\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Format: <code>latitude,longitude<\/code><\/li>\n\n\n\n<li>Scootercam&#8217;s location: Near South Haven, Michigan<\/li>\n<\/ul>\n\n\n\n<p><strong>Parameters:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong><code>unitGroup=us<\/code><\/strong>\n<ul class=\"wp-block-list\">\n<li>Temperature in Fahrenheit<\/li>\n\n\n\n<li>Wind speed in miles per hour<\/li>\n\n\n\n<li>Precipitation in inches<\/li>\n\n\n\n<li>Alternative: <code>unitGroup=metric<\/code> (Celsius, km\/h, mm)<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong><code>elements=...<\/code><\/strong> (What data to include)\n<ul class=\"wp-block-list\">\n<li><code>temp<\/code> &#8211; Current temperature<\/li>\n\n\n\n<li><code>humidity<\/code> &#8211; Humidity percentage<\/li>\n\n\n\n<li><code>windspeed<\/code> &#8211; Wind speed<\/li>\n\n\n\n<li><code>winddir<\/code> &#8211; Wind direction (degrees)<\/li>\n\n\n\n<li><code>aqius<\/code> &#8211; Air quality index<\/li>\n\n\n\n<li><code>precipprob<\/code> &#8211; Chance of precipitation (%)<\/li>\n\n\n\n<li><code>conditions<\/code> &#8211; Weather description (e.g., &#8220;Partly cloudy&#8221;)<\/li>\n\n\n\n<li><code>icon<\/code> &#8211; Weather icon identifier<\/li>\n\n\n\n<li><code>datetime<\/code> &#8211; Timestamp<\/li>\n\n\n\n<li><code>tempmax<\/code> &#8211; Daily high temperature<\/li>\n\n\n\n<li><code>tempmin<\/code> &#8211; Daily low temperature<\/li>\n\n\n\n<li><code>preciptype<\/code> &#8211; Type of precipitation (rain, snow, etc.)<\/li>\n\n\n\n<li><code>sunrise<\/code> &#8211; Sunrise time<\/li>\n\n\n\n<li><code>sunset<\/code> &#8211; Sunset time<\/li>\n\n\n\n<li><code>description<\/code> &#8211; Detailed forecast text<\/li>\n\n\n\n<li><code>visibility<\/code> &#8211; Visibility distance<\/li>\n\n\n\n<li><code>uvindex<\/code> &#8211; UV index<\/li>\n\n\n\n<li><code>cloudcover<\/code> &#8211; Cloud coverage percentage<\/li>\n\n\n\n<li><code>severerisk<\/code> &#8211; Severe weather risk (0-100)<\/li>\n\n\n\n<li><code>pressure<\/code> &#8211; Atmospheric pressure<\/li>\n\n\n\n<li><code>dew<\/code> &#8211; Dew point temperature<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong><code>include=current,hours,days,alerts<\/code><\/strong> (What timeframes to include)\n<ul class=\"wp-block-list\">\n<li><code>current<\/code> &#8211; Current conditions<\/li>\n\n\n\n<li><code>hours<\/code> &#8211; Hourly forecast (next 48 hours)<\/li>\n\n\n\n<li><code>days<\/code> &#8211; Daily forecast (next 15 days)<\/li>\n\n\n\n<li><code>alerts<\/code> &#8211; Weather alerts\/warnings<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong><code>key=YOUR_API_KEY<\/code><\/strong>\n<ul class=\"wp-block-list\">\n<li>Your unique Visual Crossing API key<\/li>\n\n\n\n<li>Format: <code>SQ3BFTRLVYJH9VV9GAWZ2TTXB<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udcca What We Get Back<\/h2>\n\n\n\n<p>We get a file &#8211; a <em>huge<\/em> file, over 4200 lines of structured data! Visual Crossing returns a JSON response with all this:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Current Conditions Example:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"currentConditions\": {\n    \"datetime\": \"14:30:00\",\n    \"temp\": 68.5,\n    \"humidity\": 65,\n    \"windspeed\": 12.4,\n    \"winddir\": 225,\n    \"conditions\": \"Partly cloudy\",\n    \"icon\": \"partly-cloudy-day\",\n    \"precipprob\": 20,\n    \"uvindex\": 6,\n    \"visibility\": 10.0\n  }\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Hourly Forecast Example:<\/h3>\n\n\n\n<p>for <em>every<\/em> hour (168 of them) for the next seven days:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"days\": &#91;\n    {\n      \"hours\": &#91;\n        {\n          \"datetime\": \"15:00:00\",\n          \"temp\": 69.2,\n          \"conditions\": \"Partly cloudy\",\n          \"precipprob\": 15\n        },\n        {\n          \"datetime\": \"16:00:00\",\n          \"temp\": 70.1,\n          \"conditions\": \"Mostly sunny\",\n          \"precipprob\": 10\n        }\n      ]\n    }\n  ]\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Daily Forecast Example:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"days\": &#91;\n    {\n      \"datetime\": \"2025-10-24\",\n      \"tempmax\": 72.0,\n      \"tempmin\": 58.5,\n      \"conditions\": \"Partly cloudy\",\n      \"precipprob\": 30,\n      \"sunrise\": \"07:45:00\",\n      \"sunset\": \"18:30:00\",\n      \"description\": \"Partly cloudy throughout the day with a chance of afternoon showers.\"\n    }\n  ]\n}\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83c\udf9b\ufe0f Customizing The Query<\/h2>\n\n\n\n<p>Not that we asked for it, but when AI wrote this part of the guide, it included this Example section to show how the service works. We don&#8217;t need any of this, but it&#8217;s good background anyway&#8230;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Example 1: Get Only Current Weather (Fewer API Calls)<\/h3>\n\n\n\n<p><strong>Query:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;weather.visualcrossing.com\/VisualCrossingWebServices\/rest\/services\/timeline\/42.5590784,-86.228992?unitGroup=us&amp;elements=temp,conditions,icon&amp;include=current&amp;key=YOUR_API_KEY\n<\/code><\/pre>\n\n\n\n<p><strong>What changed:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Removed hourly\/daily forecasts (<code>include=current<\/code> only)<\/li>\n\n\n\n<li>Fewer elements (just temp, conditions, icon)<\/li>\n\n\n\n<li>Uses less data<\/li>\n\n\n\n<li>Good for: Simple current weather displays<\/li>\n<\/ul>\n\n\n\n<p><strong>API Cost:<\/strong> 1 call = 1 credit<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Example 2: Get 7-Day Forecast Only (No Hourly)<\/h3>\n\n\n\n<p><strong>Query:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;weather.visualcrossing.com\/VisualCrossingWebServices\/rest\/services\/timeline\/42.5590784,-86.228992?unitGroup=us&amp;elements=datetime,tempmax,tempmin,conditions,icon,precipprob&amp;include=days&amp;key=YOUR_API_KEY\n<\/code><\/pre>\n\n\n\n<p><strong>What changed:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Only daily forecast (<code>include=days<\/code>)<\/li>\n\n\n\n<li>No current conditions or hourly<\/li>\n\n\n\n<li>Good for: Week-at-a-glance displays<\/li>\n<\/ul>\n\n\n\n<p><strong>API Cost:<\/strong> 1 call = 1 credit<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Example 3: Metric Units (Celsius)<\/h3>\n\n\n\n<p><strong>Query:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;weather.visualcrossing.com\/VisualCrossingWebServices\/rest\/services\/timeline\/42.5590784,-86.228992?unitGroup=metric&amp;elements=temp,humidity,windspeed&amp;include=current&amp;key=YOUR_API_KEY\n<\/code><\/pre>\n\n\n\n<p><strong>What changed:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>unitGroup=metric<\/code> instead of <code>us<\/code><\/li>\n\n\n\n<li>Returns: Celsius, km\/h, millimeters<\/li>\n<\/ul>\n\n\n\n<p><strong>Result:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"temp\": 20.3,        \/\/ \u00b0C instead of \u00b0F\n  \"windspeed\": 20.0,   \/\/ km\/h instead of mph\n  \"precip\": 5.2        \/\/ mm instead of inches\n}\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Example 4: Specific Date Range<\/h3>\n\n\n\n<p><strong>Query:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;weather.visualcrossing.com\/VisualCrossingWebServices\/rest\/services\/timeline\/42.5590784,-86.228992\/2025-10-24\/2025-10-31?unitGroup=us&amp;include=days&amp;key=YOUR_API_KEY\n<\/code><\/pre>\n\n\n\n<p><strong>What changed:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Added date range: <code>\/2025-10-24\/2025-10-31<\/code><\/li>\n\n\n\n<li>Returns forecast for specific week<\/li>\n\n\n\n<li>Good for: Planning events<\/li>\n<\/ul>\n\n\n\n<p><strong>API Cost:<\/strong> 1 call = 1 credit (regardless of date range)<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Example 5: Historical Weather<\/h3>\n\n\n\n<p><strong>Query:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;weather.visualcrossing.com\/VisualCrossingWebServices\/rest\/services\/timeline\/42.5590784,-86.228992\/2025-10-01\/2025-10-01?unitGroup=us&amp;include=days&amp;key=YOUR_API_KEY\n<\/code><\/pre>\n\n\n\n<p><strong>What changed:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Past date (October 1, 2025)<\/li>\n\n\n\n<li>Returns actual observed weather<\/li>\n\n\n\n<li>Good for: Historical analysis, comparisons<\/li>\n<\/ul>\n\n\n\n<p><strong>API Cost:<\/strong> 1 call = 1 credit<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Example 6: Different Location<\/h3>\n\n\n\n<p><strong>Query:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;weather.visualcrossing.com\/VisualCrossingWebServices\/rest\/services\/timeline\/41.8781,-87.6298?unitGroup=us&amp;include=current&amp;key=YOUR_API_KEY\n<\/code><\/pre>\n\n\n\n<p><strong>What changed:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Different coordinates: <code>41.8781,-87.6298<\/code> (Chicago, IL)<\/li>\n\n\n\n<li>Everything else the same<\/li>\n<\/ul>\n\n\n\n<p><strong>How to find coordinates:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Google Maps: Right-click location \u2192 &#8220;What&#8217;s here?&#8221;<\/li>\n\n\n\n<li>Shows: <code>41.8781, -87.6298<\/code> (copy these)<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd0d Alternative Query Methods<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">By City Name<\/h3>\n\n\n\n<p><strong>Query:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;weather.visualcrossing.com\/VisualCrossingWebServices\/rest\/services\/timeline\/Chicago,IL?unitGroup=us&amp;include=current&amp;key=YOUR_API_KEY\n<\/code><\/pre>\n\n\n\n<p><strong>Pros:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2705 Easier to read<\/li>\n\n\n\n<li>\u2705 No need to look up coordinates<\/li>\n<\/ul>\n\n\n\n<p><strong>Cons:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u274c Less precise<\/li>\n\n\n\n<li>\u274c Can be ambiguous (multiple cities with same name)<\/li>\n<\/ul>\n\n\n\n<p><strong>Best practice:<\/strong> Use coordinates for reliability<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">By ZIP Code<\/h3>\n\n\n\n<p><strong>Query:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;weather.visualcrossing.com\/VisualCrossingWebServices\/rest\/services\/timeline\/49090?unitGroup=us&amp;include=current&amp;key=YOUR_API_KEY\n<\/code><\/pre>\n\n\n\n<p><strong>Pros:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2705 Simple<\/li>\n\n\n\n<li>\u2705 Precise enough for most uses<\/li>\n<\/ul>\n\n\n\n<p><strong>Cons:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u274c US only<\/li>\n\n\n\n<li>\u274c ZIP codes can cover large areas<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udcb0 API Usage &amp; Costs<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Free Tier<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>1,000 calls per day<\/strong><\/li>\n\n\n\n<li><strong>15-day forecast<\/strong><\/li>\n\n\n\n<li><strong>Historical data back to January 1, 1970<\/strong><\/li>\n\n\n\n<li>All features included<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Your Current Usage<\/h3>\n\n\n\n<p><strong>Update frequency:<\/strong> Every 5 minutes<br><strong>Calls per day:<\/strong> 288 (24 hours \u00d7 60 minutes \u00f7 5 minutes)<br><strong>Calls per month:<\/strong> ~8,640<br><strong>Free tier remaining:<\/strong> 712 calls\/day for other uses<\/p>\n\n\n\n<p><strong>You&#8217;re using 28.8% of your daily free tier<\/strong> \u2705<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Optimization Ideas<\/h3>\n\n\n\n<p><strong>Current:<\/strong> 5 minutes = 288 calls\/day<\/p>\n\n\n\n<p><strong>Options:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>10 minutes = 144 calls\/day (50% savings, still very fresh)<\/li>\n\n\n\n<li>15 minutes = 96 calls\/day (67% savings, perfectly adequate)<\/li>\n\n\n\n<li>30 minutes = 48 calls\/day (83% savings, still current)<\/li>\n<\/ul>\n\n\n\n<p><strong>Recommendation:<\/strong> 10 minutes is a good balance<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83c\udfaf Understanding Elements<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Temperature Elements<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>elements=temp,tempmax,tempmin,feelslike,dew\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>temp<\/code> &#8211; Current\/forecast temperature<\/li>\n\n\n\n<li><code>tempmax<\/code> &#8211; Daily high temperature<\/li>\n\n\n\n<li><code>tempmin<\/code> &#8211; Daily low temperature<\/li>\n\n\n\n<li><code>feelslike<\/code> &#8211; &#8220;Feels like&#8221; temperature (with wind chill\/heat index)<\/li>\n\n\n\n<li><code>dew<\/code> &#8211; Dew point temperature<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Precipitation Elements<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>elements=precip,precipprob,preciptype,precipcover,snow,snowdepth\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>precip<\/code> &#8211; Amount of precipitation (inches or mm)<\/li>\n\n\n\n<li><code>precipprob<\/code> &#8211; Probability of precipitation (0-100%)<\/li>\n\n\n\n<li><code>preciptype<\/code> &#8211; Type: rain, snow, freezing rain, ice<\/li>\n\n\n\n<li><code>precipcover<\/code> &#8211; Percentage of day with precipitation<\/li>\n\n\n\n<li><code>snow<\/code> &#8211; Amount of snow<\/li>\n\n\n\n<li><code>snowdepth<\/code> &#8211; Depth of snow on ground<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Wind Elements<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>elements=windspeed,winddir,windgust\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>windspeed<\/code> &#8211; Average wind speed<\/li>\n\n\n\n<li><code>winddir<\/code> &#8211; Wind direction in degrees (0=N, 90=E, 180=S, 270=W)<\/li>\n\n\n\n<li><code>windgust<\/code> &#8211; Maximum wind gust speed<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Sky\/Visibility Elements<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>elements=cloudcover,visibility,solarradiation,solarenergy,uvindex\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>cloudcover<\/code> &#8211; Cloud coverage percentage (0-100%)<\/li>\n\n\n\n<li><code>visibility<\/code> &#8211; Visibility distance (miles or km)<\/li>\n\n\n\n<li><code>solarradiation<\/code> &#8211; Solar radiation (W\/m\u00b2)<\/li>\n\n\n\n<li><code>solarenergy<\/code> &#8211; Total solar energy (MJ\/m\u00b2)<\/li>\n\n\n\n<li><code>uvindex<\/code> &#8211; UV index (0-11+)<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Air Quality Elements<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>elements=aqius,pm25,pm10,o3,no2,so2,co\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>aqius<\/code> &#8211; Air Quality Index (US scale)<\/li>\n\n\n\n<li><code>pm25<\/code> &#8211; Fine particulate matter<\/li>\n\n\n\n<li><code>pm10<\/code> &#8211; Coarse particulate matter<\/li>\n\n\n\n<li><code>o3<\/code> &#8211; Ozone<\/li>\n\n\n\n<li><code>no2<\/code> &#8211; Nitrogen dioxide<\/li>\n\n\n\n<li><code>so2<\/code> &#8211; Sulfur dioxide<\/li>\n\n\n\n<li><code>co<\/code> &#8211; Carbon monoxide<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Time Elements<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>elements=datetime,datetimeEpoch,sunrise,sunset,moonphase\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>datetime<\/code> &#8211; Date\/time in readable format<\/li>\n\n\n\n<li><code>datetimeEpoch<\/code> &#8211; Unix timestamp<\/li>\n\n\n\n<li><code>sunrise<\/code> &#8211; Sunrise time<\/li>\n\n\n\n<li><code>sunset<\/code> &#8211; Sunset time<\/li>\n\n\n\n<li><code>moonphase<\/code> &#8211; Moon phase (0=new, 0.5=full)<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Severe Weather Elements<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>elements=severerisk,conditions,description\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>severerisk<\/code> &#8211; Risk of severe weather (0-100)<\/li>\n\n\n\n<li><code>conditions<\/code> &#8211; Brief description (&#8220;Partly cloudy&#8221;)<\/li>\n\n\n\n<li><code>description<\/code> &#8211; Detailed forecast text<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udcdd Common Query Patterns<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Pattern 1: Current Conditions Dashboard<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>?unitGroup=us\n&amp;elements=temp,humidity,windspeed,winddir,conditions,icon,feelslike\n&amp;include=current\n&amp;key=YOUR_API_KEY\n<\/code><\/pre>\n\n\n\n<p><strong>Use case:<\/strong> Homepage weather widget<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Pattern 2: 7-Day Forecast<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>?unitGroup=us\n&amp;elements=datetime,tempmax,tempmin,conditions,icon,precipprob\n&amp;include=days\n&amp;key=YOUR_API_KEY\n<\/code><\/pre>\n\n\n\n<p><strong>Use case:<\/strong> Week ahead planning<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Pattern 3: Hourly Forecast (Next 24 Hours)<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>?unitGroup=us\n&amp;elements=datetime,temp,conditions,icon,precipprob\n&amp;include=hours\n&amp;key=YOUR_API_KEY\n<\/code><\/pre>\n\n\n\n<p><strong>Use case:<\/strong> Detailed near-term forecast<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Pattern 4: Complete Weather Station<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>?unitGroup=us\n&amp;elements=temp,humidity,windspeed,winddir,pressure,visibility,cloudcover,uvindex,aqius,conditions,icon\n&amp;include=current\n&amp;key=YOUR_API_KEY\n<\/code><\/pre>\n\n\n\n<p><strong>Use case:<\/strong> Full weather station display<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Pattern 5: Alerts Only<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>?unitGroup=us\n&amp;elements=conditions\n&amp;include=current,alerts\n&amp;key=YOUR_API_KEY\n<\/code><\/pre>\n\n\n\n<p><strong>Use case:<\/strong> Weather warning system<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd27 Query Testing<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Test Your Query in Browser<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Copy your full query URL<\/li>\n\n\n\n<li>Replace <code>YOUR_API_KEY<\/code> with your actual key<\/li>\n\n\n\n<li>Paste into browser address bar<\/li>\n\n\n\n<li>Press Enter<\/li>\n\n\n\n<li>Browser shows JSON response<\/li>\n<\/ol>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;weather.visualcrossing.com\/VisualCrossingWebServices\/rest\/services\/timeline\/42.5590784,-86.228992?unitGroup=us&amp;include=current&amp;key=SQ3BFTRLVYJH9VV9GAWZ2TTXB\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">What You Should See<\/h3>\n\n\n\n<p><strong>Success (200 OK):<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"queryCost\": 1,\n  \"latitude\": 42.559,\n  \"longitude\": -86.229,\n  \"resolvedAddress\": \"42.5590784,-86.228992\",\n  \"address\": \"42.5590784,-86.228992\",\n  \"timezone\": \"America\/Detroit\",\n  \"currentConditions\": {\n    \"datetime\": \"14:30:00\",\n    \"temp\": 68.5,\n    ...\n  }\n}\n<\/code><\/pre>\n\n\n\n<p><strong>Error (Invalid Key):<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"errorCode\": 401,\n  \"message\": \"Invalid API key\"\n}\n<\/code><\/pre>\n\n\n\n<p><strong>Error (Exceeded Limit):<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"errorCode\": 429,\n  \"message\": \"Too many requests\"\n}\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udca1 Pro Tips<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Tip 1: Cache Results<\/h3>\n\n\n\n<p>Don&#8217;t call the API more than needed. Weather doesn&#8217;t change that fast!<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Current conditions: Update every 5-15 minutes<\/li>\n\n\n\n<li>Hourly forecast: Update every 30-60 minutes<\/li>\n\n\n\n<li>Daily forecast: Update every 2-4 hours<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Tip 2: Use Minimal Elements<\/h3>\n\n\n\n<p>Only request data you actually display. Fewer elements = faster response.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Tip 3: Combine Timeframes<\/h3>\n\n\n\n<p>One query can get current + hourly + daily:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&amp;include=current,hours,days\n<\/code><\/pre>\n\n\n\n<p>This is still 1 API call!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Tip 4: Monitor Usage<\/h3>\n\n\n\n<p>Check your Visual Crossing dashboard: https:\/\/www.visualcrossing.com\/account<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Tip 5: Handle Errors Gracefully<\/h3>\n\n\n\n<p>Your script should:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check for valid response<\/li>\n\n\n\n<li>Fall back to cached data if API fails<\/li>\n\n\n\n<li>Log errors for debugging<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83c\udf0d Location Examples<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Major US Cities<\/h3>\n\n\n\n<p><strong>New York City:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>40.7128,-74.0060\n<\/code><\/pre>\n\n\n\n<p><strong>Los Angeles:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>34.0522,-118.2437\n<\/code><\/pre>\n\n\n\n<p><strong>Chicago:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>41.8781,-87.6298\n<\/code><\/pre>\n\n\n\n<p><strong>Miami:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>25.7617,-80.1918\n<\/code><\/pre>\n\n\n\n<p><strong>Seattle:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>47.6062,-122.3321\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">How to Get Coordinates<\/h3>\n\n\n\n<p><strong>Method 1: Google Maps<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Right-click location<\/li>\n\n\n\n<li>Click &#8220;What&#8217;s here?&#8221;<\/li>\n\n\n\n<li>Copy coordinates from bottom<\/li>\n<\/ol>\n\n\n\n<p><strong>Method 2: Visual Crossing<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Type city name<\/li>\n\n\n\n<li>It returns coordinates in response<\/li>\n<\/ul>\n\n\n\n<p><strong>Method 3: GPS Device<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Most smartphones show coordinates in Maps app<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udcd6 Quick Reference<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Your Current Query Structure<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>BASE_URL \/ LOCATION ? PARAMETERS &amp; key=API_KEY\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Parameter Format<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>?param1=value1&amp;param2=value2&amp;param3=value3\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Essential Parameters<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>unitGroup<\/code> &#8211; us or metric<\/li>\n\n\n\n<li><code>elements<\/code> &#8211; comma-separated list<\/li>\n\n\n\n<li><code>include<\/code> &#8211; current, hours, days, alerts<\/li>\n\n\n\n<li><code>key<\/code> &#8211; your API key<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Response Format<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"resolvedAddress\": \"Location name\",\n  \"days\": &#91;...],\n  \"currentConditions\": {...},\n  \"alerts\": &#91;...]\n}\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83c\udf93 Learning More<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Official Documentation<\/h3>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/www.visualcrossing.com\/resources\/documentation\/weather-api\/timeline-weather-api\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">API Explorer (Interactive)<\/h3>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/www.visualcrossing.com\/weather\/weather-data-services\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Your Account Dashboard<\/h3>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/www.visualcrossing.com\/account\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Support<\/h3>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/www.visualcrossing.com\/weather-api-support\n<\/div><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>Remember:<\/strong> Your current query gets everything you need. These examples are just for understanding and customization!<\/p>\n\n\n\n<p><strong>Current query cost:<\/strong> 1 credit per call<br><strong>Daily calls:<\/strong> 288 (every 5 minutes)<br><strong>Daily usage:<\/strong> 28.8% of free tier \u2705<br><strong>Status:<\/strong> Excellent! Plenty of room to spare.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Scootercam is a weather station website with webcams. It started out as a hobby but has outgrown its sandbox, and is on its way to a sustainable future as a set of easily-maintained WordPress plugins. Each plugin does something specific, and we&#8217;ll dive into each of them later. First though is the view from 30,000 &#8230; <a title=\"Scootercam &#8211; the Big Picture\" class=\"read-more\" href=\"https:\/\/scootercam.net\/blog\/scootercam-the-big-picture\/\" aria-label=\"Read more about Scootercam &#8211; the Big Picture\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[38],"tags":[],"class_list":["post-751","post","type-post","status-publish","format-standard","hentry","category-plugins"],"_links":{"self":[{"href":"https:\/\/scootercam.net\/blog\/wp-json\/wp\/v2\/posts\/751","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scootercam.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scootercam.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scootercam.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/scootercam.net\/blog\/wp-json\/wp\/v2\/comments?post=751"}],"version-history":[{"count":2,"href":"https:\/\/scootercam.net\/blog\/wp-json\/wp\/v2\/posts\/751\/revisions"}],"predecessor-version":[{"id":754,"href":"https:\/\/scootercam.net\/blog\/wp-json\/wp\/v2\/posts\/751\/revisions\/754"}],"wp:attachment":[{"href":"https:\/\/scootercam.net\/blog\/wp-json\/wp\/v2\/media?parent=751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scootercam.net\/blog\/wp-json\/wp\/v2\/categories?post=751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scootercam.net\/blog\/wp-json\/wp\/v2\/tags?post=751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}