2

I'd like to define the default value for a field in QGIS using OpenWeather API request.

We use QField for outdoor data collecting, and some of the actual weather conditions are important for us. I've an OpenWeather API key, and I want to insert the temperature, the visibility, the wind speed and direction to the field as human-readable text.

The API request is something similar:

http://api.openweathermap.org/data/2.5/weather?lat=47.6&lon=20.4&appid=my_api_key&units=metric.

In the browser the result is:  
{"coord":{"lon":20.4,"lat":47.6},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"base":"stations","main":{"temp":0,"pressure":1037,"humidity":73,"temp_min":0,"temp_max":0},"visibility":10000,"wind":{"speed":1.32,"deg":219.501},"clouds":{"all":0},"dt":1551050100,"sys":{"type":1,"id":6676,"message":0.0032,"country":"HU","sunrise":1550986040,"sunset":1551024985},"id":716877,"name":"Nyulasszőllő","cod":200}

I'd like to write this data to the field something like this:
0°C; visibility: 10000 m; wind: 1.32 m/s, 219.501°;

Is it possible to fill my field with this method in QGIS?
Will it work with QField?
How should I define the default value for the form?

  • OpenWeather Map API returns XML or JSON > QGIS using add vector and select protocol will not work (if it was GeoJSON) you could add it as vector file. – Mapperz Feb 25 at 1:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.