Oyster Harvest Area Closure Analysis 0.1
Prediction and analysis of NSW oyster harvest area closures.
Loading...
Searching...
No Matches
location.h File Reference
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <cjson/cJSON.h>
#include <curl/curl.h>
#include <log.h>
#include "WillyWeather/authenticate.h"
#include "http.h"
#include "utils.h"
Include dependency graph for location.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  WW_Location_TypeDef
 Location data from Willy Weather request. More...
 
struct  WW_Locations_TypeDef
 Locations of Willy Weather stations. More...
 

Macros

#define WW_LOCATION_BUF   150
 Buffer for location information. More...
 
#define WW_LOCATION_URL_BUF   200
 Buffer for request location URL. More...
 
#define WW_MAX_NUM_LOCATONS   100
 Max number of locations in buffer. More...
 

Functions

CURLcode WillyWeather_GetLocationByName (char *name, WW_Location_TypeDef *location_info)
 Get an ID describing a location from Willy Weather. More...
 

Macro Definition Documentation

◆ WW_LOCATION_BUF

#define WW_LOCATION_BUF   150

Buffer for location information.

◆ WW_LOCATION_URL_BUF

#define WW_LOCATION_URL_BUF   200

Buffer for request location URL.

◆ WW_MAX_NUM_LOCATONS

#define WW_MAX_NUM_LOCATONS   100

Max number of locations in buffer.

Function Documentation

◆ WillyWeather_GetLocationByName()

CURLcode WillyWeather_GetLocationByName ( char *  name,
WW_Location_TypeDef location_info 
)

Get an ID describing a location from Willy Weather.

Get location ID from Willy Weather.

Willy Weather forecast requires a location ID. This is obtained by querying by name (e.g. Batemans Bay). The response contains cJSON data of which multiple sites can be obatined (limited through q_limit).

WW_Location_TypeDef *location_info;
WillyWeather_GetLocationByName("Batemans Bay", location_info);
CURLcode WillyWeather_GetLocationByName(char *name, WW_Location_TypeDef *location_info)
Get an ID describing a location from Willy Weather.
Definition: location.c:26
Location data from Willy Weather request.
Definition: location.h:24
See also
https://www.willyweather.com.au/api/docs/v2.html#location-get-search-by-query

@info Name can contain spaces. These are encoded as "%20". @info Response length is limited to one as to ensure only one location is returned per query.

Parameters
nameName to query against.
location_infoLocation structure to populate.
Returns
The result status code provided by CURL.