Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
geocoder_util.h
Go to the documentation of this file.
1 /*
2  * geocoder_util.h
3  *
4  * Created on: 30 May 2018
5  * Author: billy
6  */
7 
8 #ifndef CORE_SHARED_UTIL_INCLUDE_GEOCODER_UTIL_H_
9 #define CORE_SHARED_UTIL_INCLUDE_GEOCODER_UTIL_H_
10 
12 #include "typedefs.h"
13 #include "jansson.h"
14 #include "address.h"
15 #include "grassroots_server.h"
16 
17 
30 typedef struct
31 {
38  bool (*gt_geocoder_fn) (Address *address_p, const char *uri_s);
39 
40 
41  bool (*gt_reverse_geocoder_fn) (Address *address_p, const char *uri_s);
42 
53  const char *gt_geocoder_url_s;
54 
55 
66  const char *gt_reverse_geocoder_url_s;
67 
68 } GeocoderTool;
69 
70 
71 
72 #ifdef __cplusplus
73 extern "C"
74 {
75 #endif
76 
77 
87 
88 
89 
99 
100 
101 
102 GRASSROOTS_GEOCODER_LOCAL bool DetermineGPSLocationForAddressByOpencage (Address *address_p, const char *geocoder_uri_s);
103 
104 
105 GRASSROOTS_GEOCODER_LOCAL bool DetermineGPSLocationForAddressByLocationIQ (Address *address_p, const char *geocoder_uri_s);
106 
107 
108 
109 GRASSROOTS_GEOCODER_LOCAL int CallGeocoderWebService (CurlTool *curl_tool_p, const char *url_s, Address *address_p, int (*parse_results_fn) (Address *address_p, const json_t *web_service_results_p));
110 
111 
112 GRASSROOTS_GEOCODER_LOCAL int AddEscapedValueToByteBuffer (const char *value_s, ByteBuffer *buffer_p, CurlTool *tool_p, const char *prefix_s);
113 
114 
115 GRASSROOTS_GEOCODER_LOCAL bool BuildURLUsingAddressParameter (ByteBuffer *buffer_p, CurlTool *curl_p, const Address * const address_p, const char *api_call_s, const char *sep_s);
116 
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #endif /* CORE_SHARED_UTIL_INCLUDE_GEOCODER_UTIL_H_ */
GeocoderTool
A datatype that accesses an external geocoding provider to calculate the geographic data for an Addre...
Definition: geocoder_util.h:30
CurlTool
A tool for making http(s) requests and responses.
Definition: curl_tools.h:74
GRASSROOTS_GEOCODER_LOCAL
#define GRASSROOTS_GEOCODER_LOCAL
Definition: grassroots_geocoder_library.h:47
grassroots_server.h
address.h
typedefs.h
Address
A datatype for storing a postal address as well as its geographic coordinates if possible.
Definition: address.h:21
grassroots_geocoder_library.h
DetermineAddressForGPSLocation
bool DetermineAddressForGPSLocation(Address *address_p, GeocoderTool *tool_p, GrassrootsServer *grassroots_p)
Determine the geographic coordinates for a given Address using a given GeocoderTool.
GrassrootsServer
Definition: grassroots_server.h:45
GRASSROOTS_GEOCODER_API
#define GRASSROOTS_GEOCODER_API
Definition: grassroots_geocoder_library.h:46
DetermineGPSLocationForAddress
bool DetermineGPSLocationForAddress(Address *address_p, GeocoderTool *tool_p, GrassrootsServer *grassroots_p)
Determine the geographic coordinates for a given Address using a given GeocoderTool.
ByteBuffer
A datatype to allow an automatically growing buffer for appending data to.
Definition: byte_buffer.h:35