EVOLUTION-MANAGER
Edit File: ogr__geocoding_8h.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.5"/> <title>OGR: ogr_geocoding.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">OGR </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.5 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">ogr_geocoding.h File Reference</div> </div> </div><!--header--> <div class="contents"> <div class="textblock"><code>#include "<a class="el" href="cpl__port_8h_source.html">cpl_port.h</a>"</code><br/> <code>#include "<a class="el" href="ogr__api_8h_source.html">ogr_api.h</a>"</code><br/> </div> <p><a href="ogr__geocoding_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:ac3e12320a8046248b992fd0ce4731903"><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct__OGRGeocodingSessionHS.html">OGRGeocodingSessionH</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="ogr__geocoding_8h.html#ac3e12320a8046248b992fd0ce4731903">OGRGeocodeCreateSession</a> (char **papszOptions)</td></tr> <tr class="memdesc:ac3e12320a8046248b992fd0ce4731903"><td class="mdescLeft"> </td><td class="mdescRight">Creates a session handle for geocoding requests. <a href="#ac3e12320a8046248b992fd0ce4731903">More...</a><br/></td></tr> <tr class="separator:ac3e12320a8046248b992fd0ce4731903"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:aaa63dc51f49e998ef667bff176e9986c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="ogr__geocoding_8h.html#aaa63dc51f49e998ef667bff176e9986c">OGRGeocodeDestroySession</a> (<a class="el" href="struct__OGRGeocodingSessionHS.html">OGRGeocodingSessionH</a> hSession)</td></tr> <tr class="memdesc:aaa63dc51f49e998ef667bff176e9986c"><td class="mdescLeft"> </td><td class="mdescRight">Destroys a session handle for geocoding requests. <a href="#aaa63dc51f49e998ef667bff176e9986c">More...</a><br/></td></tr> <tr class="separator:aaa63dc51f49e998ef667bff176e9986c"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a2b0382ceb7e3935d7fe1da2adada564e"><td class="memItemLeft" align="right" valign="top">OGRLayerH </td><td class="memItemRight" valign="bottom"><a class="el" href="ogr__geocoding_8h.html#a2b0382ceb7e3935d7fe1da2adada564e">OGRGeocode</a> (<a class="el" href="struct__OGRGeocodingSessionHS.html">OGRGeocodingSessionH</a> hSession, const char *pszQuery, char **papszStructuredQuery, char **papszOptions)</td></tr> <tr class="memdesc:a2b0382ceb7e3935d7fe1da2adada564e"><td class="mdescLeft"> </td><td class="mdescRight">Runs a geocoding request. <a href="#a2b0382ceb7e3935d7fe1da2adada564e">More...</a><br/></td></tr> <tr class="separator:a2b0382ceb7e3935d7fe1da2adada564e"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:abd49f38501af49461928469495861617"><td class="memItemLeft" align="right" valign="top">OGRLayerH </td><td class="memItemRight" valign="bottom"><a class="el" href="ogr__geocoding_8h.html#abd49f38501af49461928469495861617">OGRGeocodeReverse</a> (<a class="el" href="struct__OGRGeocodingSessionHS.html">OGRGeocodingSessionH</a> hSession, double dfLon, double dfLat, char **papszOptions)</td></tr> <tr class="memdesc:abd49f38501af49461928469495861617"><td class="mdescLeft"> </td><td class="mdescRight">Runs a reverse geocoding request. <a href="#abd49f38501af49461928469495861617">More...</a><br/></td></tr> <tr class="separator:abd49f38501af49461928469495861617"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a1a463f7364dbcbc080ab442f681bdb7e"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="ogr__geocoding_8h.html#a1a463f7364dbcbc080ab442f681bdb7e">OGRGeocodeFreeResult</a> (OGRLayerH hLayer)</td></tr> <tr class="memdesc:a1a463f7364dbcbc080ab442f681bdb7e"><td class="mdescLeft"> </td><td class="mdescRight">Destroys the result of a geocoding request. <a href="#a1a463f7364dbcbc080ab442f681bdb7e">More...</a><br/></td></tr> <tr class="separator:a1a463f7364dbcbc080ab442f681bdb7e"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>C API for geocoding client. </p> </div><h2 class="groupheader">Function Documentation</h2> <a class="anchor" id="a2b0382ceb7e3935d7fe1da2adada564e"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">OGRLayerH OGRGeocode </td> <td>(</td> <td class="paramtype"><a class="el" href="struct__OGRGeocodingSessionHS.html">OGRGeocodingSessionH</a> </td> <td class="paramname"><em>hSession</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"><em>pszQuery</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char ** </td> <td class="paramname"><em>papszStructuredQuery</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char ** </td> <td class="paramname"><em>papszOptions</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Runs a geocoding request. </p> <p>If the result is not found in cache, a GET request will be sent to resolve the query.</p> <p>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.</p> <p>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 <a class="el" href="ogr__geocoding_8h.html#a1a463f7364dbcbc080ab442f681bdb7e" title="Destroys the result of a geocoding request. ">OGRGeocodeFreeResult()</a>.</p> <p>Note: this function is also available as the SQL <a href="ogr_sql_sqlite.html#ogr_sql_sqlite_ogr_geocode_function">ogr_geocode()</a> function of the SQL SQLite dialect.</p> <p>The list of recognized options is : </p> <ul> <li> ADDRESSDETAILS=0 or 1: Include a breakdown of the address into elements Defaults to 1. (Known to work with OSM and MapQuest Nominatim) </li> <li> COUNTRYCODES=code1,code2,...codeN: Limit search results to a specific country (or a list of countries). The codes must fellow ISO 3166-1, i.e. gb for United Kingdom, de for Germany, etc.. (Known to work with OSM and MapQuest Nominatim) </li> <li> LIMIT=number: the number of records to return. Unlimited if not specified. (Known to work with OSM and MapQuest Nominatim) </li> <li> RAW_FEATURE=YES: to specify that a 'raw' field must be added to the returned feature with the raw XML content. </li> <li> EXTRA_QUERY_PARAMETERS=params: additionnal parameters for the GET request. </li> </ul> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">hSession</td><td>the geocoding session handle. </td></tr> <tr><td class="paramname">pszQuery</td><td>the string to geocode. </td></tr> <tr><td class="paramname">papszStructuredQuery</td><td>unused for now. Must be NULL. </td></tr> <tr><td class="paramname">papszOptions</td><td>a list of options or NULL.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>a OGR layer with the result(s), or NULL in case of error. The returned layer must be freed with <a class="el" href="ogr__geocoding_8h.html#a1a463f7364dbcbc080ab442f681bdb7e" title="Destroys the result of a geocoding request. ">OGRGeocodeFreeResult()</a>.</dd></dl> <dl class="section since"><dt>Since</dt><dd>GDAL 1.10 </dd></dl> <p>References <a class="el" href="cpl__error_8h.html#aad2b98dd58e4de706a245faddac90403">CPLError()</a>, and <a class="el" href="cpl__string_8h.html#adf2c0e5051d8f5c7fc742e4be41e935a">CPLEscapeString()</a>.</p> </div> </div> <a class="anchor" id="ac3e12320a8046248b992fd0ce4731903"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="struct__OGRGeocodingSessionHS.html">OGRGeocodingSessionH</a> OGRGeocodeCreateSession </td> <td>(</td> <td class="paramtype">char ** </td> <td class="paramname"><em>papszOptions</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Creates a session handle for geocoding requests. </p> <p>Available papszOptions values: </p> <ul> <li> "CACHE_FILE" : Defaults to "ogr_geocode_cache.sqlite" (or otherwise "ogr_geocode_cache.csv" if the SQLite driver isn't available). Might be any CSV, SQLite or PostgreSQL datasource. </li> <li> "READ_CACHE" : "TRUE" (default) or "FALSE" </li> <li> "WRITE_CACHE" : "TRUE" (default) or "FALSE" </li> <li> "SERVICE": <a href="http://wiki.openstreetmap.org/wiki/Nominatim">"OSM_NOMINATIM"</a> (default), <a href="http://open.mapquestapi.com/nominatim/">"MAPQUEST_NOMINATIM"</a>, <a href="http://developer.yahoo.com/geo/placefinder/">"YAHOO"</a>, <a href="http://www.geonames.org/export/geonames-search.html">"GEONAMES"</a>, <a href="http://msdn.microsoft.com/en-us/library/ff701714.aspx">"BING"</a> or other value. Note: "YAHOO" is no longer available as a free service. </li> <li> "EMAIL": used by OSM_NOMINATIM. Optional, but recommanded. </li> <li> "USERNAME": used by GEONAMES. Compulsory in that case. </li> <li> "KEY": used by BING. Compulsory in that case. </li> <li> "APPLICATION": used to set the User-Agent MIME header. Defaults to GDAL/OGR version string. </li> <li> "LANGUAGE": used to set the Accept-Language MIME header. Preferred language order for showing search results. </li> <li> "DELAY": minimum delay, in second, between 2 consecutive queries. Defaults to 1.0. </li> <li> "QUERY_TEMPLATE": URL template for GET requests. Must contain one and only one occurence of %s in it. If not specified, for SERVICE=OSM_NOMINATIM, MAPQUEST_NOMINATIM, YAHOO, GEONAMES or BING, the URL template is hard-coded. </li> <li> "REVERSE_QUERY_TEMPLATE": URL template for GET requests for reverse geocoding. Must contain one and only one occurence of {lon} and {lat} in it. If not specified, for SERVICE=OSM_NOMINATIM, MAPQUEST_NOMINATIM, YAHOO, GEONAMES or BING, the URL template is hard-coded. </li> </ul> <p>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.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">papszOptions</td><td>NULL, or a NULL-terminated list of string options.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>an handle that should be freed with <a class="el" href="ogr__geocoding_8h.html#aaa63dc51f49e998ef667bff176e9986c" title="Destroys a session handle for geocoding requests. ">OGRGeocodeDestroySession()</a>, or NULL in case of failure.</dd></dl> <dl class="section since"><dt>Since</dt><dd>GDAL 1.10 </dd></dl> <p>References <a class="el" href="cpl__conv_8h.html#aa07cd1b2aa5e76eb67ba952440198796">CPLAtofM()</a>, <a class="el" href="cpl__conv_8h.html#a5b990672a0221115c9b54a8931554136">CPLCalloc()</a>, <a class="el" href="cpl__error_8h.html#aad2b98dd58e4de706a245faddac90403">CPLError()</a>, <a class="el" href="cpl__conv_8h.html#ae46fcfcea1b2e8c24738542613ba4752">CPLGetExtension()</a>, <a class="el" href="cpl__conv_8h.html#a464d6861faf9f6272317d160a3ad9a81">CPLStrdup()</a>, <a class="el" href="cpl__string_8h.html#ada798bb0fafd08c7908d0f3716f341b3">CSLTestBoolean()</a>, and <a class="el" href="ogr__geocoding_8h.html#aaa63dc51f49e998ef667bff176e9986c">OGRGeocodeDestroySession()</a>.</p> </div> </div> <a class="anchor" id="aaa63dc51f49e998ef667bff176e9986c"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void OGRGeocodeDestroySession </td> <td>(</td> <td class="paramtype"><a class="el" href="struct__OGRGeocodingSessionHS.html">OGRGeocodingSessionH</a> </td> <td class="paramname"><em>hSession</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Destroys a session handle for geocoding requests. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">hSession</td><td>the handle to destroy.</td></tr> </table> </dd> </dl> <dl class="section since"><dt>Since</dt><dd>GDAL 1.10 </dd></dl> <p>References <a class="el" href="ogr__api_8h.html#ad3abed0c3b232fe55a580726536fe6fa">OGRReleaseDataSource()</a>.</p> <p>Referenced by <a class="el" href="ogr__geocoding_8h.html#ac3e12320a8046248b992fd0ce4731903">OGRGeocodeCreateSession()</a>.</p> </div> </div> <a class="anchor" id="a1a463f7364dbcbc080ab442f681bdb7e"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void OGRGeocodeFreeResult </td> <td>(</td> <td class="paramtype">OGRLayerH </td> <td class="paramname"><em>hLayer</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Destroys the result of a geocoding request. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">hLayer</td><td>the layer returned by <a class="el" href="ogr__geocoding_8h.html#a2b0382ceb7e3935d7fe1da2adada564e" title="Runs a geocoding request. ">OGRGeocode()</a> or <a class="el" href="ogr__geocoding_8h.html#abd49f38501af49461928469495861617" title="Runs a reverse geocoding request. ">OGRGeocodeReverse()</a> to destroy.</td></tr> </table> </dd> </dl> <dl class="section since"><dt>Since</dt><dd>GDAL 1.10 </dd></dl> </div> </div> <a class="anchor" id="abd49f38501af49461928469495861617"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">OGRLayerH OGRGeocodeReverse </td> <td>(</td> <td class="paramtype"><a class="el" href="struct__OGRGeocodingSessionHS.html">OGRGeocodingSessionH</a> </td> <td class="paramname"><em>hSession</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double </td> <td class="paramname"><em>dfLon</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double </td> <td class="paramname"><em>dfLat</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char ** </td> <td class="paramname"><em>papszOptions</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Runs a reverse geocoding request. </p> <p>If the result is not found in cache, a GET request will be sent to resolve the query.</p> <p>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.</p> <p>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 <a class="el" href="ogr__geocoding_8h.html#a1a463f7364dbcbc080ab442f681bdb7e" title="Destroys the result of a geocoding request. ">OGRGeocodeFreeResult()</a>.</p> <p>Note: this function is also available as the SQL <a href="ogr_sql_sqlite.html#ogr_sql_sqlite_ogr_geocode_function">ogr_geocode_reverse()</a> function of the SQL SQLite dialect.</p> <p>The list of recognized options is : </p> <ul> <li> ZOOM=a_level: to query a specific zoom level. Only understood by the OSM Nominatim service. </li> <li> RAW_FEATURE=YES: to specify that a 'raw' field must be added to the returned feature with the raw XML content. </li> <li> EXTRA_QUERY_PARAMETERS=params: additionnal parameters for the GET request for reverse geocoding. </li> </ul> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">hSession</td><td>the geocoding session handle. </td></tr> <tr><td class="paramname">dfLon</td><td>the longitude. </td></tr> <tr><td class="paramname">dfLat</td><td>the latitude. </td></tr> <tr><td class="paramname">papszOptions</td><td>a list of options or NULL.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>a OGR layer with the result(s), or NULL in case of error. The returned layer must be freed with <a class="el" href="ogr__geocoding_8h.html#a1a463f7364dbcbc080ab442f681bdb7e" title="Destroys the result of a geocoding request. ">OGRGeocodeFreeResult()</a>.</dd></dl> <dl class="section since"><dt>Since</dt><dd>GDAL 1.10 </dd></dl> <p>References <a class="el" href="cpl__error_8h.html#aad2b98dd58e4de706a245faddac90403">CPLError()</a>.</p> </div> </div> </div><!-- contents --> <hr> Generated for GDAL by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.8.5. </body> </html>