Home > OS >  How to change temp kelvin in celcius with weather data
How to change temp kelvin in celcius with weather data

Time:07-28

export default {
  name: 'App',
  data () {
    return {
      api_key: '==REDACTED==',
       url_base: 'https://api.openweathermap.org/data/2.5/weather?lat=35&lon=139&appid={API key}',
       query: '',
       weather: {}
    }
  },

CodePudding user response:

You need to set the units query parameter to metric

Ex:

https://api.openweathermap.org/data/2.5/weather?lat=35&lon=139&units=metric&appid={API key}

As mentioned in documentation.

units optional standard, metric, imperial. When you do not use the units parameter, format is standard by default. Temperature is available in Fahrenheit, Celsius and Kelvin units.

For temperature in Fahrenheit use units=imperial For temperature in Celsius use units=metric Temperature in Kelvin is used by default, no need to use units parameter in API call List of all API parameters with units openweathermap.org/weather-data

CodePudding user response:

Looking at the API docs you can add units=metric to the url and receive the response with celsius values. Other units may change as well, see here

  • Related