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:
fun c t io n co n ver t (co n versio n Type , value) { i f (value === null || value === u n de f i ne d || t ypeo f value !== ' nu mber') { re turn "Invalid input" ; // Handle null, undefined, or non-numeric input } swi t ch (co n versio n Type) { case 'C_ t o_F' : // Celsius to Fahrenheit le t co n ver te dC t oF = (value * 9 / 5 ) + 32 ; re turn co n ver te dC t oF. t oFixed( 2 ) + " °F" ; case 'mm_ t o_i n ' : // Millimeters to Inches le t co n ver te dMmToI n = value * 0.0393701 ; re turn co n ver te dMmToI n . t oFixed( 2 ) + " in" ; case 'km_ t o_mi' : // Kilometers to Miles le t co n ver te dKmToMi = value * 0.621371 ; re turn co n ver te dKmToMi. t oFixed( 2 ) + " mi" ; case 'km/h_ t o_mph' : // Kilometers per hour to Miles per hour le t co n ver te dKmHToMph = value * 0.621371 ; re turn co n ver te dKmHToMph. t oFixed( 2 ) + " mph" ; case 'millibar_ t o_psi' : // Millibar to PSI le t co n ver te dMillibarToPsi = value * 0.0145038 ; re turn co n ver te dMillibarToPsi. t oFixed( 2 ) + " psi" ; de fault : re turn "Invalid conversion type" ; } } co ns ole.log(co n ver t ('C_ t o_F' , 10 )); // Output: 50.00 °F co ns ole.log(co n ver t ('mm_ t o_i n ' , 25 )); // Output: 0.98 in co ns ole.log(co n ver t ('i n valid_ t ype' , 5 )); // Output: Invalid conversion type
Convert units using a library
You can also use a library such as convert-units to convert units:
// module
impor
t
co
n
ver
t
fr
om
'co
n
ver
t
-
u
n
i
ts
';
// or script inclusion
// <script src="https://unpkg.com/convert@5.8.0/dist/index.js" ></script>
// let convert = convert.convert
fun
c
t
io
n
co
n
ver
t
Wi
t
hLibrary(co
n
versio
n
Type
,
value)
{
i
f
(value
===
null
||
value
===
u
n
de
f
i
ne
d
||
t
ypeo
f
value
!==
'
nu
mber')
{
re
turn
"Invalid input"
;
}
tr
y
{
swi
t
ch
(co
n
versio
n
Type)
{
case
'C_
t
o_F'
:
le
t
co
n
ver
te
dC
t
oF
=
co
n
ver
t
(value
,
'C').
t
o('F');
re
turn
co
n
ver
te
dC
t
oF.
t
oFixed(
2
)
+
" °F"
;
case
'mm_
t
o_i
n
'
:
le
t
co
n
ver
te
dMmToI
n
=
co
n
ver
t
(value
,
'mm').
t
o('i
n
');
re
turn
co
n
ver
te
dMmToI
n
.
t
oFixed(
2
)
+
" in"
;
case
'km_
t
o_mi'
:
le
t
co
n
ver
te
dKmToMi
=
co
n
ver
t
(value
,
'km').
t
o('mi');
re
turn
co
n
ver
te
dKmToMi.
t
oFixed(
2
)
+
" mi"
;
case
'km/h_
t
o_mph'
:
// km/h is not directly supported, so we convert km to mi
// then assume it's per hour
le
t
co
n
ver
te
dKmToMiValue
=
co
n
ver
t
(value
,
'km').
t
o('mi');
re
turn
co
n
ver
te
dKmToMiValue.
t
oFixed(
2
)
+
" mph"
;
case
'millibar_
t
o_psi'
:
// millibar is not directly supported, so convert millibar to bar, then bar to psi
le
t
barValue
=
value
/
1000
;
le
t
co
n
ver
te
dMillibarToPsi
=
co
n
ver
t
(barValue
,
'bar').
t
o('psi');
re
turn
co
n
ver
te
dMillibarToPsi.
t
oFixed(
2
)
+
" psi"
;
de
fault
:
re
turn
"Invalid conversion type"
;
}
}
ca
t
ch
(error)
{
co
ns
ole.error(
"Conversion error:"
,
error);
re
turn
"Conversion failed"
;
}
}
co
ns
ole.log(co
n
ver
t
Wi
t
hLibrary('C_
t
o_F'
,
10
));
// Output: 50.00 °F
co
ns
ole.log(co
n
ver
t
Wi
t
hLibrary('mm_
t
o_i
n
'
,
25
));
// Output: 0.98 in
co
ns
ole.log(co
n
ver
t
Wi
t
hLibrary('i
n
valid_
t
ype'
,
5
));
// Output: Invalid conversion type