GDAL
|
C API for geocoding client. More...
Go to the source code of this file.
Typedefs | |
typedef struct _OGRGeocodingSessionHS * | OGRGeocodingSessionH |
Opaque type for a geocoding session. | |
Functions | |
OGRGeocodingSessionH | OGRGeocodeCreateSession (char **papszOptions) |
Creates a session handle for geocoding requests. More... | |
void | OGRGeocodeDestroySession (OGRGeocodingSessionH hSession) |
Destroys a session handle for geocoding requests. More... | |
OGRLayerH | OGRGeocode (OGRGeocodingSessionH hSession, const char *pszQuery, char **papszStructuredQuery, char **papszOptions) |
Runs a geocoding request. More... | |
OGRLayerH | OGRGeocodeReverse (OGRGeocodingSessionH hSession, double dfLon, double dfLat, char **papszOptions) |
Runs a reverse geocoding request. More... | |
void | OGRGeocodeFreeResult (OGRLayerH hLayer) |
Destroys the result of a geocoding request. More... | |
C API for geocoding client.
OGRLayerH OGRGeocode | ( | OGRGeocodingSessionH | hSession, |
const char * | pszQuery, | ||
char ** | papszStructuredQuery, | ||
char ** | papszOptions | ||
) |
Runs a geocoding request.
If the result is not found in cache, a GET request will be sent to resolve the query.
Note: most online services have Term of Uses. You are kindly requested to read and follow them. For the OpenStreetMap Nominatim service, this implementation will make sure that no more than one request is sent by second, but there might be other restrictions that you must follow by other means.
In case of success, the return of this function is a OGR layer that contain zero, one or several features matching the query. Note that the geometry of the features is not necessarily a point. The returned layer must be freed with OGRGeocodeFreeResult().
Note: this function is also available as the SQL ogr_geocode() function of the SQL SQLite dialect.
The list of recognized options is :
hSession | the geocoding session handle. |
pszQuery | the string to geocode. |
papszStructuredQuery | unused for now. Must be NULL. |
papszOptions | a list of options or NULL. |
OGRGeocodingSessionH OGRGeocodeCreateSession | ( | char ** | papszOptions | ) |
Creates a session handle for geocoding requests.
Available papszOptions values:
All the above options can also be set by defining the configuration option of the same name, prefixed by OGR_GEOCODE_. For example "OGR_GEOCODE_SERVICE" for the "SERVICE" option.
papszOptions | NULL, or a NULL-terminated list of string options. |
void OGRGeocodeDestroySession | ( | OGRGeocodingSessionH | hSession | ) |
Destroys a session handle for geocoding requests.
hSession | the handle to destroy. |
void OGRGeocodeFreeResult | ( | OGRLayerH | hLayer | ) |
Destroys the result of a geocoding request.
hLayer | the layer returned by OGRGeocode() or OGRGeocodeReverse() to destroy. |
OGRLayerH OGRGeocodeReverse | ( | OGRGeocodingSessionH | hSession, |
double | dfLon, | ||
double | dfLat, | ||
char ** | papszOptions | ||
) |
Runs a reverse geocoding request.
If the result is not found in cache, a GET request will be sent to resolve the query.
Note: most online services have Term of Uses. You are kindly requested to read and follow them. For the OpenStreetMap Nominatim service, this implementation will make sure that no more than one request is sent by second, but there might be other restrictions that you must follow by other means.
In case of success, the return of this function is a OGR layer that contain zero, one or several features matching the query. The returned layer must be freed with OGRGeocodeFreeResult().
Note: this function is also available as the SQL ogr_geocode_reverse() function of the SQL SQLite dialect.
The list of recognized options is :
hSession | the geocoding session handle. |
dfLon | the longitude. |
dfLat | the latitude. |
papszOptions | a list of options or NULL. |