You can choose from METRIC
or IMPERIAL
for all Weather API endpoints.
To request a unit system, set units_system
to METRIC
or IMPERIAL
. No
units_system
specified will default to METRIC
.
https://weather.googleapis.com/v1/currentConditions:lookup?key=YOUR_API_KEY&location.latitude=LATITUDE&location.longitude=LONGITUDE&units_system=IMPERIAL
Weather API values changed from METRIC to IMPERIAL units
The following table lists the Weather API response values that can be converted between unit systems.
Unit Conversion (Metric to Imperial) | Weather API Values |
---|---|
Celsius (°C) to Fahrenheit (°F) | Temperature, Feels Like, Dew Point, Heat Index, Wind Chill, Wet Bulb |
Millimeters (mm) to Inches (in) | Precipitation, QPF, Ice Thickness |
Kilometers/hour (km/h) to Miles/hour (mph) | Wind Speed, Wind Gust |
Kilometers (km) to Miles (mi) | Visibility |
Example for currentConditions response
The following table lists values included in the response body of a
currentConditions
request. Values in bold blue have changed from METRIC
to
IMPERIAL
units:
Weather API feature | METRIC (default) | IMPERIAL |
---|---|---|
Current Time | 2025-03-06T11:08:49.126979608Z | 3/6/2025, 6:08:49 AM |
Time Zone | America/New_York | America/New_York |
Is Daytime | FALSE | FALSE |
Weather Description | Mostly cloudy | Mostly cloudy |
Temperature | 11.5 °C | 52.7 °F |
Feels Like | 9.9 °C | 49.7 °F |
Dew Point | 8.7 °C | 47.6 °F |
Heat Index | 11.5 °C | 52.7 °F |
Wind Chill | 9.9 °C | 49.7 °F |
Relative Humidity | 83 % | 83 % |
UV Index | 0 | 0 |
Precipitation Probability | 9 % | 9 % |
Precipitation | 0 mm | 0 in |
Thunderstorm Probability | 0 | 0 |
Air Pressure | 991.47 mb | 991.47 mb |
Wind Direction | 275 ° | 275 ° |
Wind Direction (Cardinal) | WEST | WEST |
Wind Speed | 14 km/h | 9 mph |
Wind Gust | 27 km/h | 17 mph |
Visibility | 10 km | 6 mi |
Cloud Cover | 65 % | 65 % |
Temperature Change | 1.4 °C | 2.6 °F |
Max Temperature | 13.2 °C | 55.8 °F |
Min Temperature | 10.1 °C | 50.1 °F |
QPF | 27.5564 mm | 1.0849 in |
Units systems in the world
Unit systems by country
Most countries outside of the United States use the METRIC
system, while the
United States uses the IMPERIAL
system. Some countries, such as the United
Kingdom and Canada, use a hybrid of both systems. For a map and full list of
countries that use the metric system, see
Metrication.
Convert units from Weather API response
Convert units manually
You can convert units manually using the following script:
function convert(conversionType, value) { if (value === null || value === undefined || typeof value !== 'number') { return "Invalid input"; // Handle null, undefined, or non-numeric input } switch (conversionType) { case 'C_to_F': // Celsius to Fahrenheit let convertedCtoF = (value * 9 / 5) + 32; return convertedCtoF.toFixed(2) + " °F"; case 'mm_to_in': // Millimeters to Inches let convertedMmToIn = value * 0.0393701; return convertedMmToIn.toFixed(2) + " in"; case 'km_to_mi': // Kilometers to Miles let convertedKmToMi = value * 0.621371; return convertedKmToMi.toFixed(2) + " mi"; case 'km/h_to_mph': // Kilometers per hour to Miles per hour let convertedKmHToMph = value * 0.621371; return convertedKmHToMph.toFixed(2) + " mph"; case 'millibar_to_psi': // Millibar to PSI let convertedMillibarToPsi = value * 0.0145038; return convertedMillibarToPsi.toFixed(2) + " psi"; default: return "Invalid conversion type"; } } console.log(convert('C_to_F', 10)); // Output: 50.00 °F console.log(convert('mm_to_in', 25)); // Output: 0.98 in console.log(convert('invalid_type', 5)); // Output: Invalid conversion type
Convert units using a library
You can also use a library such as convert-units to convert units:
// module
import convert from 'convert-units';
// or script inclusion
// <script src="https://unpkg.com/convert@5.8.0/dist/index.js" ></script>
// let convert = convert.convert
function convertWithLibrary(conversionType, value) {
if (value === null || value === undefined || typeof value !== 'number') {
return "Invalid input";
}
try {
switch (conversionType) {
case 'C_to_F':
let convertedCtoF = convert(value, 'C').to('F');
return convertedCtoF.toFixed(2) + " °F";
case 'mm_to_in':
let convertedMmToIn = convert(value, 'mm').to('in');
return convertedMmToIn.toFixed(2) + " in";
case 'km_to_mi':
let convertedKmToMi = convert(value, 'km').to('mi');
return convertedKmToMi.toFixed(2) + " mi";
case 'km/h_to_mph':
// km/h is not directly supported, so we convert km to mi
// then assume it's per hour
let convertedKmToMiValue = convert(value, 'km').to('mi');
return convertedKmToMiValue.toFixed(2) + " mph";
case 'millibar_to_psi':
// millibar is not directly supported, so convert millibar to bar, then bar to psi
let barValue = value / 1000;
let convertedMillibarToPsi = convert(barValue, 'bar').to('psi');
return convertedMillibarToPsi.toFixed(2) + " psi";
default:
return "Invalid conversion type";
}
} catch (error) {
console.error("Conversion error:", error);
return "Conversion failed";
}
}
console.log(convertWithLibrary('C_to_F', 10)); // Output: 50.00 °F
console.log(convertWithLibrary('mm_to_in', 25)); // Output: 0.98 in
console.log(convertWithLibrary('invalid_type', 5)); // Output: Invalid conversion type