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’ll dive into each of them later. First though is the view from 30,000 feet – the big picture, how data and images come together on the world’s most important website.
Weather data
There are two ways Scootercam gets weather data – like the current temp, or tomorrow’s chance of rain:
- Home weather stations connected to the internet. These could include the LaCrosse weather station or the home-built units I’ve added. They’re usually limited to temperature, humidity, wind speed and direction, and barometric pressure. They take periodic readings and send the data somewhere, which may be an app, “the cloud,” or a website like Scootercam that’s been set up to receive the data.
- “Data aggregators” (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’s updated and downloaded every few minutes. Scripts on Scootercam handle it, and some of that’s why we’re here today.
The data we get from Visual Crossing is essential for Scootercam’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’ll get to those later. First, a look at how it gets here – the Scootercam Weather and Moon Phase Updater.
This plugin should be able to run without intervention, but knowing what it’s doing will help if there’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’s how the Scootercam Weather and Moon Phase Updater works.
In simplest terms, the plugin ties in with an external service to send a scheduled message back to Scootercam – every 5 minutes for Visual Crossing weather data, every hour for moon data. Let’s start with Visual Crossing.
Visual Crossing Weather API – Query Examples
Understanding your weather API queries
๐ Your Current Query
This is what Scootercam’s api-get-viscross.php script sends to Visual Crossing:
https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/42.5590784,-86.228992?unitGroup=us&elements=temp,humidity,windspeed,winddir,aqius,precipprob,conditions,icon,datetime,tempmax,tempmin,preciptype,sunrise,sunset,description,visibility,uvindex,cloudcover,severerisk,pressure,dew&include=current,hours,days,alerts&key=YOUR_API_KEY
Breaking It Down:
Base URL:
https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/
Location:
42.5590784,-86.228992
- Format:
latitude,longitude - Scootercam’s location: Near South Haven, Michigan
Parameters:
unitGroup=us- Temperature in Fahrenheit
- Wind speed in miles per hour
- Precipitation in inches
- Alternative:
unitGroup=metric(Celsius, km/h, mm)
elements=...(What data to include)temp– Current temperaturehumidity– Humidity percentagewindspeed– Wind speedwinddir– Wind direction (degrees)aqius– Air quality indexprecipprob– Chance of precipitation (%)conditions– Weather description (e.g., “Partly cloudy”)icon– Weather icon identifierdatetime– Timestamptempmax– Daily high temperaturetempmin– Daily low temperaturepreciptype– Type of precipitation (rain, snow, etc.)sunrise– Sunrise timesunset– Sunset timedescription– Detailed forecast textvisibility– Visibility distanceuvindex– UV indexcloudcover– Cloud coverage percentagesevererisk– Severe weather risk (0-100)pressure– Atmospheric pressuredew– Dew point temperature
include=current,hours,days,alerts(What timeframes to include)current– Current conditionshours– Hourly forecast (next 48 hours)days– Daily forecast (next 15 days)alerts– Weather alerts/warnings
key=YOUR_API_KEY- Your unique Visual Crossing API key
- Format:
SQ3BFTRLVYJH9VV9GAWZ2TTXB
๐ What We Get Back
We get a file – a huge file, over 4200 lines of structured data! Visual Crossing returns a JSON response with all this:
Current Conditions Example:
{
"currentConditions": {
"datetime": "14:30:00",
"temp": 68.5,
"humidity": 65,
"windspeed": 12.4,
"winddir": 225,
"conditions": "Partly cloudy",
"icon": "partly-cloudy-day",
"precipprob": 20,
"uvindex": 6,
"visibility": 10.0
}
}
Hourly Forecast Example:
for every hour (168 of them) for the next seven days:
{
"days": [
{
"hours": [
{
"datetime": "15:00:00",
"temp": 69.2,
"conditions": "Partly cloudy",
"precipprob": 15
},
{
"datetime": "16:00:00",
"temp": 70.1,
"conditions": "Mostly sunny",
"precipprob": 10
}
]
}
]
}
Daily Forecast Example:
{
"days": [
{
"datetime": "2025-10-24",
"tempmax": 72.0,
"tempmin": 58.5,
"conditions": "Partly cloudy",
"precipprob": 30,
"sunrise": "07:45:00",
"sunset": "18:30:00",
"description": "Partly cloudy throughout the day with a chance of afternoon showers."
}
]
}
๐๏ธ Customizing The Query
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’t need any of this, but it’s good background anyway…
Example 1: Get Only Current Weather (Fewer API Calls)
Query:
https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/42.5590784,-86.228992?unitGroup=us&elements=temp,conditions,icon&include=current&key=YOUR_API_KEY
What changed:
- Removed hourly/daily forecasts (
include=currentonly) - Fewer elements (just temp, conditions, icon)
- Uses less data
- Good for: Simple current weather displays
API Cost: 1 call = 1 credit
Example 2: Get 7-Day Forecast Only (No Hourly)
Query:
https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/42.5590784,-86.228992?unitGroup=us&elements=datetime,tempmax,tempmin,conditions,icon,precipprob&include=days&key=YOUR_API_KEY
What changed:
- Only daily forecast (
include=days) - No current conditions or hourly
- Good for: Week-at-a-glance displays
API Cost: 1 call = 1 credit
Example 3: Metric Units (Celsius)
Query:
https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/42.5590784,-86.228992?unitGroup=metric&elements=temp,humidity,windspeed&include=current&key=YOUR_API_KEY
What changed:
unitGroup=metricinstead ofus- Returns: Celsius, km/h, millimeters
Result:
{
"temp": 20.3, // ยฐC instead of ยฐF
"windspeed": 20.0, // km/h instead of mph
"precip": 5.2 // mm instead of inches
}
Example 4: Specific Date Range
Query:
https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/42.5590784,-86.228992/2025-10-24/2025-10-31?unitGroup=us&include=days&key=YOUR_API_KEY
What changed:
- Added date range:
/2025-10-24/2025-10-31 - Returns forecast for specific week
- Good for: Planning events
API Cost: 1 call = 1 credit (regardless of date range)
Example 5: Historical Weather
Query:
https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/42.5590784,-86.228992/2025-10-01/2025-10-01?unitGroup=us&include=days&key=YOUR_API_KEY
What changed:
- Past date (October 1, 2025)
- Returns actual observed weather
- Good for: Historical analysis, comparisons
API Cost: 1 call = 1 credit
Example 6: Different Location
Query:
https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/41.8781,-87.6298?unitGroup=us&include=current&key=YOUR_API_KEY
What changed:
- Different coordinates:
41.8781,-87.6298(Chicago, IL) - Everything else the same
How to find coordinates:
- Google Maps: Right-click location โ “What’s here?”
- Shows:
41.8781, -87.6298(copy these)
๐ Alternative Query Methods
By City Name
Query:
https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/Chicago,IL?unitGroup=us&include=current&key=YOUR_API_KEY
Pros:
- โ Easier to read
- โ No need to look up coordinates
Cons:
- โ Less precise
- โ Can be ambiguous (multiple cities with same name)
Best practice: Use coordinates for reliability
By ZIP Code
Query:
https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/49090?unitGroup=us&include=current&key=YOUR_API_KEY
Pros:
- โ Simple
- โ Precise enough for most uses
Cons:
- โ US only
- โ ZIP codes can cover large areas
๐ฐ API Usage & Costs
Free Tier
- 1,000 calls per day
- 15-day forecast
- Historical data back to January 1, 1970
- All features included
Your Current Usage
Update frequency: Every 5 minutes
Calls per day: 288 (24 hours ร 60 minutes รท 5 minutes)
Calls per month: ~8,640
Free tier remaining: 712 calls/day for other uses
You’re using 28.8% of your daily free tier โ
Optimization Ideas
Current: 5 minutes = 288 calls/day
Options:
- 10 minutes = 144 calls/day (50% savings, still very fresh)
- 15 minutes = 96 calls/day (67% savings, perfectly adequate)
- 30 minutes = 48 calls/day (83% savings, still current)
Recommendation: 10 minutes is a good balance
๐ฏ Understanding Elements
Temperature Elements
elements=temp,tempmax,tempmin,feelslike,dew
temp– Current/forecast temperaturetempmax– Daily high temperaturetempmin– Daily low temperaturefeelslike– “Feels like” temperature (with wind chill/heat index)dew– Dew point temperature
Precipitation Elements
elements=precip,precipprob,preciptype,precipcover,snow,snowdepth
precip– Amount of precipitation (inches or mm)precipprob– Probability of precipitation (0-100%)preciptype– Type: rain, snow, freezing rain, iceprecipcover– Percentage of day with precipitationsnow– Amount of snowsnowdepth– Depth of snow on ground
Wind Elements
elements=windspeed,winddir,windgust
windspeed– Average wind speedwinddir– Wind direction in degrees (0=N, 90=E, 180=S, 270=W)windgust– Maximum wind gust speed
Sky/Visibility Elements
elements=cloudcover,visibility,solarradiation,solarenergy,uvindex
cloudcover– Cloud coverage percentage (0-100%)visibility– Visibility distance (miles or km)solarradiation– Solar radiation (W/mยฒ)solarenergy– Total solar energy (MJ/mยฒ)uvindex– UV index (0-11+)
Air Quality Elements
elements=aqius,pm25,pm10,o3,no2,so2,co
aqius– Air Quality Index (US scale)pm25– Fine particulate matterpm10– Coarse particulate mattero3– Ozoneno2– Nitrogen dioxideso2– Sulfur dioxideco– Carbon monoxide
Time Elements
elements=datetime,datetimeEpoch,sunrise,sunset,moonphase
datetime– Date/time in readable formatdatetimeEpoch– Unix timestampsunrise– Sunrise timesunset– Sunset timemoonphase– Moon phase (0=new, 0.5=full)
Severe Weather Elements
elements=severerisk,conditions,description
severerisk– Risk of severe weather (0-100)conditions– Brief description (“Partly cloudy”)description– Detailed forecast text
๐ Common Query Patterns
Pattern 1: Current Conditions Dashboard
?unitGroup=us
&elements=temp,humidity,windspeed,winddir,conditions,icon,feelslike
&include=current
&key=YOUR_API_KEY
Use case: Homepage weather widget
Pattern 2: 7-Day Forecast
?unitGroup=us
&elements=datetime,tempmax,tempmin,conditions,icon,precipprob
&include=days
&key=YOUR_API_KEY
Use case: Week ahead planning
Pattern 3: Hourly Forecast (Next 24 Hours)
?unitGroup=us
&elements=datetime,temp,conditions,icon,precipprob
&include=hours
&key=YOUR_API_KEY
Use case: Detailed near-term forecast
Pattern 4: Complete Weather Station
?unitGroup=us
&elements=temp,humidity,windspeed,winddir,pressure,visibility,cloudcover,uvindex,aqius,conditions,icon
&include=current
&key=YOUR_API_KEY
Use case: Full weather station display
Pattern 5: Alerts Only
?unitGroup=us
&elements=conditions
&include=current,alerts
&key=YOUR_API_KEY
Use case: Weather warning system
๐ง Query Testing
Test Your Query in Browser
- Copy your full query URL
- Replace
YOUR_API_KEYwith your actual key - Paste into browser address bar
- Press Enter
- Browser shows JSON response
Example:
https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/42.5590784,-86.228992?unitGroup=us&include=current&key=SQ3BFTRLVYJH9VV9GAWZ2TTXB
What You Should See
Success (200 OK):
{
"queryCost": 1,
"latitude": 42.559,
"longitude": -86.229,
"resolvedAddress": "42.5590784,-86.228992",
"address": "42.5590784,-86.228992",
"timezone": "America/Detroit",
"currentConditions": {
"datetime": "14:30:00",
"temp": 68.5,
...
}
}
Error (Invalid Key):
{
"errorCode": 401,
"message": "Invalid API key"
}
Error (Exceeded Limit):
{
"errorCode": 429,
"message": "Too many requests"
}
๐ก Pro Tips
Tip 1: Cache Results
Don’t call the API more than needed. Weather doesn’t change that fast!
- Current conditions: Update every 5-15 minutes
- Hourly forecast: Update every 30-60 minutes
- Daily forecast: Update every 2-4 hours
Tip 2: Use Minimal Elements
Only request data you actually display. Fewer elements = faster response.
Tip 3: Combine Timeframes
One query can get current + hourly + daily:
&include=current,hours,days
This is still 1 API call!
Tip 4: Monitor Usage
Check your Visual Crossing dashboard: https://www.visualcrossing.com/account
Tip 5: Handle Errors Gracefully
Your script should:
- Check for valid response
- Fall back to cached data if API fails
- Log errors for debugging
๐ Location Examples
Major US Cities
New York City:
40.7128,-74.0060
Los Angeles:
34.0522,-118.2437
Chicago:
41.8781,-87.6298
Miami:
25.7617,-80.1918
Seattle:
47.6062,-122.3321
How to Get Coordinates
Method 1: Google Maps
- Right-click location
- Click “What’s here?”
- Copy coordinates from bottom
Method 2: Visual Crossing
- Type city name
- It returns coordinates in response
Method 3: GPS Device
- Most smartphones show coordinates in Maps app
๐ Quick Reference
Your Current Query Structure
BASE_URL / LOCATION ? PARAMETERS & key=API_KEY
Parameter Format
?param1=value1¶m2=value2¶m3=value3
Essential Parameters
unitGroup– us or metricelements– comma-separated listinclude– current, hours, days, alertskey– your API key
Response Format
{
"resolvedAddress": "Location name",
"days": [...],
"currentConditions": {...},
"alerts": [...]
}
๐ Learning More
Official Documentation
API Explorer (Interactive)
Your Account Dashboard
Support
Remember: Your current query gets everything you need. These examples are just for understanding and customization!
Current query cost: 1 credit per call
Daily calls: 288 (every 5 minutes)
Daily usage: 28.8% of free tier โ
Status: Excellent! Plenty of room to spare.