geo_search_reverse_geocode()

Perform a reverse geocode search.

Synopsis:

#include <geo_search.h>
geo_search_error_t geo_search_reverse_geocode(geo_search_handle_t *handle, geo_search_reply_t *reply, double lat, double lon, geo_search_boundary_t boundary)

Since:

BlackBerry 10.0.0

Arguments:

handle

A geo_search handle.

reply

A reply handle.

lat

Latitude in decimal degrees of the geographic coordinate to determine the location of. This must be specified using the WGS84 datum.

lon

Longitude in decimal degrees of the geographic coordinate to determine the location of. This must be specified using the WGS84 datum.

boundary

The level of specificity according to geo_search_boundary_t.

Library:

libgeo_search (For the qcc command, use the -l geo_search option to link against this library)

Description:

Given a geographic coordinate and boundary type this function provides a reply containing one or more matching results. It is possible that no result may be found, in which case this function returns GEO_SEARCH_ERROR_SERVER_EMPTY.

To access the search result see the geo_search_reply_* functions. Note that depending on the search boundary specified the fields in the search result may not all be populated. For example if GEO_SEARCH_BOUNDARY_CITY is specified only the city and country fields may have values that are not empty.

Note that this function may make a network request and blocks until the remote server responds.

The following shows how to perform a reverse geocode search:
 geo_search_handle_t handle;
 geo_search_error_t error = geo_search_open( &handle );
 if ( error == GEO_SEARCH_OK ) {
   geo_search_reply_t reply;
   double lat = 39.8017;
   double lon = -89.6436;

   error = geo_search_reverse_geocode(&handle,
                                      &reply,
                                      lat,
                                      lon, 
                                      GEO_SEARCH_BOUNDARY_CITY);
   if ( error == GEO_SEARCH_OK ) {
     // do something with the results in the search reply

     geo_search_free_reply( &reply );
   }
   geo_search_close( &handle );
 }

See geo_search_reply_get_name() for an example of how to access the results in a search reply.

Returns:

GEO_SEARCH_OK if successful, otherwise one of the values from geo_search_error_t.