| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes
TeAddressLocator Class Reference
Geocoding

A class to handle the geocoder support. More...

`#include <TeAddressLocator.h>`

List of all members.

## Public Member Functions

| TeAddressLocator (TeDatabase *db)
| Constructor.
virtual | ~TeAddressLocator ()
| Virtual destructor.
bool | createAddressMetadataTable (void)
| Creates the table to store metadata for geocoding tables.
bool | insertAddressMetadata (const TeAddressMetadata &metadata)
| Inserts a new metadata for an attribute table layer and saves in the database.
bool | updateAddressMetadata (const TeAddressMetadata &metadata)
| Updates the metadata of an attribute table layer and saves in the database.
bool | deleteAddressMetadata (const int &tableId)
| Removes the metadata for the attribute table layer on the database an clear memory.
bool | loadAddressMetadata (const int &tableId)
| Loads a metadata for an attribute table layer.
bool | isMetadataLoaded () const
| Returns true if metadata was loaded.
TeAddressMetadata | getAddressLocatorMetadata () const
| Returns the metadata of the geocode base table.
bool | setAddressLocatorMetadata (const TeAddressMetadata &m)
| Set the metadata.
string | errorMessage () const
| Returns the error message.
void | setCentroidAddressMetadata (const TeCentroidAddressMetadata &cMetadata)
| Information about a layer to be used as an alternative for geocoding.
void | setReplaceSpecialChars (const bool &r)
bool | getReplaceSpecialChars (void) const
void | setSplitChar (const string &splitChar)
bool | getAllAddressMetadataLayer (const int &layerId, vector< TeAddressMetadata > &addVec)
| Retrieves all metadata for a layer.
bool | getAllAddressMetadataTheme (const int &themeId, vector< TeAddressMetadata > &addVec)
| Retrieves all metadata for a theme.
bool | getAddressLocatorLayers (vector< pair< int, string > > &layerNameVec)
| Retrieves all layer name that has an address location table.
bool | getAddressLocatorLayerTables (vector< pair< int, string > > &tableNameVec, const int &layerId)
| Retrieves all layer table names that is register as an address find table for a given layerId.
bool | findGeocodingTables (vector< pair< int, string > > &tableNames)
| Finds all geocoding table in a TerraLib database.
int | findAddress (const TeAddress &address, vector< TeAddressDescription > &addressesFound, const bool &doExaustiveSearch=false)
| Looks the attribute description to transform a name location on an address.
void | findCoordinates (const TeAddress &add, vector< TeAddressDescription > &addresses)
| Finds segment and does an interpolation.
void | findCoordinate (const TeAddress &add, TeAddressDescription &address)
| Finds segment and does an interpolation.
bool | addressGeocode (TeGeocodeTableMetadata &tableMetadata, const string &newLayerName, const string &reportName, const string &reportDir, const bool &doExaustive=false, TeAbstractAddressNotifyFunctor *notifyFunction=0)
| Spatialize a table based on the indicated fields.
bool | loadDictionary (const string &dictionaryFileName)
| Load a dictionary to change words in the searched addresses.
bool | loadAddressCompoundNames ()
bool | convertColumnNameToUpper ()
| Used to make columns in upper case.
bool | addCompleteNameColumn ()
| Used to join columns in one field.

## Protected Member Functions

int | findExact (const TeAddress &address, const string &fullName, const bool &withNumber, vector< TeAddressDescription > &addressesFound)
| Looks the attribute description to transform a name location on an address.
int | findPattern (const TeAddress &address, const string &fullName, const bool &withNumber, vector< TeAddressDescription > &addressesFound, const bool &disabletype=false, const bool &disabletitle=false, const bool &disablepreposition=false)
| Looks the attribute description to transform a name location on an address.
int | findWithDictionary (const TeAddress &address, const string &fullName, const bool &withNumber, vector< TeAddressDescription > &addressesFound)
| Looks the attribute description to transform a name location on an address.
int | findWithoutAllName (const TeAddress &address, const string &fullName, vector< TeAddressDescription > &addressesFound, const bool &disabletype=false, const bool &disabletitle=false, const bool &disablepreposition=false)
| Looks the attribute description to transform a name location on an address.
bool | findSimilarAddress (const TeAddress &address, const string &fullName, TeAddressDescription &descript)
| Looks the attribute description to transform a name location on an address.
bool | findByCentroid (const TeAddress &addressToFind, vector< TeAddressDescription > &addressesFound)
| Try to find a centroid for zip code or neighborhood.
void | fillAddressMetadata (TeAddressMetadata &metadata, TeDatabasePortal *p)
| Fill the metadata parameter.
void | fillAddressesDescription (vector< TeAddressDescription > &addresses, TeDatabasePortal *p)
| Fill address descriptions.
void | fillAddressDescription (TeAddressDescription &descript, TeDatabasePortal *p)
void | fillAddress (TeAddress &add, const TeGeocodeTableMetadata &tableMetadata, TeDatabasePortal *p)
| Fill address information.
string | mountExactWhereSQL (const TeAddress &address, const string &fullName)
| Mount a SQL to look for an address.
string | mountLikeWhereSQL (const TeAddress &address, const string &fullName)
string | mountPatternWhereSQL (const TeAddress &address, const string &fullName, const bool &disabletype=false, const bool &disabletitle=false, const bool &disablepreposition=false)
string | mountSimilarWhereSQL (const TeAddress &address)
void | normalizeAddress (TeAddress &address, string &completeName)
| Do some conversions in address fields.
void | removeHifen (string &zipCode) const
| Removes hifen if remove flag is true.
void | insertHifen (string &zipCode) const
| Removes hifen if remove flag is true.
string | makeLikeExpression (const string &str) const
| Inserts a special character in string for Like comparasion.
void | removeSpecialCharacters (string &str) const
| Remove caracteres como ponto e troca acentuados por n�o acentuados.
bool | verifyHifen (const string &tableName, const string &columnName)
bool | addReportColumn (TeGeocodeTableMetadata &tableMetadata, pair< string, string > &newColumns)
bool | findTableMetadata (TeGeocodeTableMetadata &tableMetadata)
bool | updateAddressTable (const string &c1, const int &v1, TeGeocodeTableMetadata &tableMetadata, const string &objectId)
| Update the table that contains address to be geocoded with the code returned by the geocoding process and a description of the process match.
TeDatabasePortal * | getAddressTablePortal (TeGeocodeTableMetadata &tableMetadata, int &numRows)
| Returns a portal to the address table.
void | refineFoundedLocationsByNeighBorhood (const TeAddress &address, vector< TeAddressDescription > &addressesFound)
void | refineFoundedLocationsByZipCode (const TeAddress &address, vector< TeAddressDescription > &addressesFound)
void | refineFoundedLocationsByNumberNeighboor (const TeAddress &address, vector< TeAddressDescription > &addressesFound)
void | refineFoundedLocationsByNumberZipCode (const TeAddress &address, vector< TeAddressDescription > &addressesFound)
void | cleanAddressesFound (const string &locName, vector< TeAddressDescription > &addressesFound, const bool &disabletype=false, const bool &disabletitle=false, const bool &disablepreposition=false)
void | splitAddress (TeAddress &add)
| Split address name and number.
void | queryAddresses (const string &strSQL, bool &queryExecuted, vector< TeAddressDescription > &addressesFound)
| Only to query addresses and fill result.
| TeAddressLocator (const TeAddressLocator &other)
| No copy allowed.
TeAddressLocator & | operator= (const TeAddressLocator &other)

## Protected Attributes

TeDatabase * | db_
| Database connection.
TeAddressMetadata | metadata_
| Metadata information for a geocoding base table.
TeLayer * | referenceLayer_
| Ther layer used as reference for geocoding.
TeCentroidAddressMetadata | cmetadata_
| Centroid metadata.
bool | isMetadataLoaded_
| Flag to indicate if the metadata is loaded.
string | errMsg_
| Error message description.
TeGeocoderDictionary | dictionary_
| Use a geocoder dictionary.
bool | changeSpecialChars_
| If true should replace special characters.
bool | removeHifen_
| If true the hifen is removed in zip code.
bool | removeHifenFromCentroid_
| If true the hifen is removed in zip code from the centroid table.
char | hifen_
string | splitChar_
| Used to split address name and number.
vector< string > | typesVector_
| Vector with default types for street names.
vector< string > | titlesVector_
| Vector with default titles for street names.
vector< string > | prepositionsVector_
| Vector with default prepositions for street names.

## Detailed Description

A class to handle the geocoder support.

Instances of this class contains information about a table that can be used for geocoding and methods to geocode a given address.

## Constructor & Destructor Documentation

TeAddressLocator::TeAddressLocator | ( | TeDatabase * | db | ) | `[inline]`

Constructor.

virtual TeAddressLocator::~TeAddressLocator | ( |  | ) | `[inline, virtual]`

Virtual destructor.

TeAddressLocator::TeAddressLocator | ( | const TeAddressLocator & | other | ) | `[protected]`

No copy allowed.

## Member Function Documentation

bool TeAddressLocator::addCompleteNameColumn | ( |  | ) |

Used to join columns in one field.

bool TeAddressLocator::addReportColumn | ( | TeGeocodeTableMetadata & | tableMetadata,
|  | pair< string, string > & | newColumns
| ) |  | `[protected]`

bool TeAddressLocator::addressGeocode | ( | TeGeocodeTableMetadata & | tableMetadata,
|  | const string & | newLayerName,
|  | const string & | reportName,
|  | const string & | reportDir,
|  | const bool & | doExaustive = `false`,
|  | TeAbstractAddressNotifyFunctor * | notifyFunction = `0`
| ) |  |

Spatialize a table based on the indicated fields.

void TeAddressLocator::cleanAddressesFound | ( | const string & | locName,
|  | vector< TeAddressDescription > & | addressesFound,
|  | const bool & | disabletype = `false`,
|  | const bool & | disabletitle = `false`,
|  | const bool & | disablepreposition = `false`
| ) |  | `[protected]`

bool TeAddressLocator::convertColumnNameToUpper | ( |  | ) |

Used to make columns in upper case.

bool TeAddressLocator::createAddressMetadataTable | ( | void |  | ) |

Creates the table to store metadata for geocoding tables.

bool TeAddressLocator::deleteAddressMetadata | ( | const int & | tableId | ) |

Removes the metadata for the attribute table layer on the database an clear memory.

string TeAddressLocator::errorMessage | ( |  | ) | const`[inline]`

Returns the error message.

void TeAddressLocator::fillAddress | ( | TeAddress & | add,
|  | const TeGeocodeTableMetadata & | tableMetadata,
|  | TeDatabasePortal * | p
| ) |  | `[protected]`

Fill address information.

void TeAddressLocator::fillAddressDescription | ( | TeAddressDescription & | descript,
|  | TeDatabasePortal * | p
| ) |  | `[protected]`

void TeAddressLocator::fillAddressesDescription | ( | vector< TeAddressDescription > & | addresses,
|  | TeDatabasePortal * | p
| ) |  | `[protected]`

Fill address descriptions.

void TeAddressLocator::fillAddressMetadata | ( | TeAddressMetadata & | metadata,
|  | TeDatabasePortal * | p
| ) |  | `[protected]`

Fill the metadata parameter.

int TeAddressLocator::findAddress | ( | const TeAddress & | address,
|  | vector< TeAddressDescription > & | addressesFound,
|  | const bool & | doExaustiveSearch = `false`
| ) |  |

Looks the attribute description to transform a name location on an address.

bool TeAddressLocator::findByCentroid | ( | const TeAddress & | addressToFind,
|  | vector< TeAddressDescription > & | addressesFound
| ) |  | `[protected]`

Try to find a centroid for zip code or neighborhood.

void TeAddressLocator::findCoordinate | ( | const TeAddress & | add,
|  | TeAddressDescription & | address
| ) |  |

Finds segment and does an interpolation.

void TeAddressLocator::findCoordinates | ( | const TeAddress & | add,
|  | vector< TeAddressDescription > & | addresses
| ) |  |

Finds segment and does an interpolation.

int TeAddressLocator::findExact | ( | const TeAddress & | address,
|  | const string & | fullName,
|  | const bool & | withNumber,
|  | vector< TeAddressDescription > & | addressesFound
| ) |  | `[protected]`

Looks the attribute description to transform a name location on an address.

bool TeAddressLocator::findGeocodingTables | ( | vector< pair< int, string > > & | tableNames | ) |

Finds all geocoding table in a TerraLib database.

int TeAddressLocator::findPattern | ( | const TeAddress & | address,
|  | const string & | fullName,
|  | const bool & | withNumber,
|  | vector< TeAddressDescription > & | addressesFound,
|  | const bool & | disabletype = `false`,
|  | const bool & | disabletitle = `false`,
|  | const bool & | disablepreposition = `false`
| ) |  | `[protected]`

Looks the attribute description to transform a name location on an address.

bool TeAddressLocator::findSimilarAddress | ( | const TeAddress & | address,
|  | const string & | fullName,
|  | TeAddressDescription & | descript
| ) |  | `[protected]`

Looks the attribute description to transform a name location on an address.

bool TeAddressLocator::findTableMetadata | ( | TeGeocodeTableMetadata & | tableMetadata | ) | `[protected]`

int TeAddressLocator::findWithDictionary | ( | const TeAddress & | address,
|  | const string & | fullName,
|  | const bool & | withNumber,
|  | vector< TeAddressDescription > & | addressesFound
| ) |  | `[protected]`

Looks the attribute description to transform a name location on an address.

int TeAddressLocator::findWithoutAllName | ( | const TeAddress & | address,
|  | const string & | fullName,
|  | vector< TeAddressDescription > & | addressesFound,
|  | const bool & | disabletype = `false`,
|  | const bool & | disabletitle = `false`,
|  | const bool & | disablepreposition = `false`
| ) |  | `[protected]`

Looks the attribute description to transform a name location on an address.

bool TeAddressLocator::getAddressLocatorLayers | ( | vector< pair< int, string > > & | layerNameVec | ) |

Retrieves all layer name that has an address location table.

bool TeAddressLocator::getAddressLocatorLayerTables | ( | vector< pair< int, string > > & | tableNameVec,
|  | const int & | layerId
| ) |  |

Retrieves all layer table names that is register as an address find table for a given layerId.

TeAddressMetadata TeAddressLocator::getAddressLocatorMetadata | ( |  | ) | const`[inline]`

Returns the metadata of the geocode base table.

TeDatabasePortal * TeAddressLocator::getAddressTablePortal | ( | TeGeocodeTableMetadata & | tableMetadata,
|  | int & | numRows
| ) |  | `[protected]`

Returns a portal to the address table.

bool TeAddressLocator::getAllAddressMetadataLayer | ( | const int & | layerId,
|  | vector< TeAddressMetadata > & | addVec
| ) |  |

Retrieves all metadata for a layer.

bool TeAddressLocator::getAllAddressMetadataTheme | ( | const int & | themeId,
|  | vector< TeAddressMetadata > & | addVec
| ) |  |

Retrieves all metadata for a theme.

bool TeAddressLocator::getReplaceSpecialChars | ( | void |  | ) | const`[inline]`

bool TeAddressLocator::insertAddressMetadata | ( | const TeAddressMetadata & | metadata | ) |

Inserts a new metadata for an attribute table layer and saves in the database.

void TeAddressLocator::insertHifen | ( | string & | zipCode | ) | const`[protected]`

Removes hifen if remove flag is true.

bool TeAddressLocator::isMetadataLoaded | ( |  | ) | const`[inline]`

Returns true if metadata was loaded.

bool TeAddressLocator::loadAddressCompoundNames | ( |  | ) |

bool TeAddressLocator::loadAddressMetadata | ( | const int & | tableId | ) |

Loads a metadata for an attribute table layer.

bool TeAddressLocator::loadDictionary | ( | const string & | dictionaryFileName | ) |

Load a dictionary to change words in the searched addresses.

string TeAddressLocator::makeLikeExpression | ( | const string & | str | ) | const`[protected]`

Inserts a special character in string for Like comparasion.

string TeAddressLocator::mountExactWhereSQL | ( | const TeAddress & | address,
|  | const string & | fullName
| ) |  | `[protected]`

Mount a SQL to look for an address.

string TeAddressLocator::mountLikeWhereSQL | ( | const TeAddress & | address,
|  | const string & | fullName
| ) |  | `[protected]`

string TeAddressLocator::mountPatternWhereSQL | ( | const TeAddress & | address,
|  | const string & | fullName,
|  | const bool & | disabletype = `false`,
|  | const bool & | disabletitle = `false`,
|  | const bool & | disablepreposition = `false`
| ) |  | `[protected]`

string TeAddressLocator::mountSimilarWhereSQL | ( | const TeAddress & | address | ) | `[protected]`

void TeAddressLocator::normalizeAddress | ( | TeAddress & | address,
|  | string & | completeName
| ) |  | `[protected]`

Do some conversions in address fields.

TeAddressLocator& TeAddressLocator::operator= | ( | const TeAddressLocator & | other | ) | `[protected]`

void TeAddressLocator::queryAddresses | ( | const string & | strSQL,
|  | bool & | queryExecuted,
|  | vector< TeAddressDescription > & | addressesFound
| ) |  | `[protected]`

Only to query addresses and fill result.

void TeAddressLocator::refineFoundedLocationsByNeighBorhood | ( | const TeAddress & | address,
|  | vector< TeAddressDescription > & | addressesFound
| ) |  | `[protected]`

void TeAddressLocator::refineFoundedLocationsByNumberNeighboor | ( | const TeAddress & | address,
|  | vector< TeAddressDescription > & | addressesFound
| ) |  | `[protected]`

void TeAddressLocator::refineFoundedLocationsByNumberZipCode | ( | const TeAddress & | address,
|  | vector< TeAddressDescription > & | addressesFound
| ) |  | `[protected]`

void TeAddressLocator::refineFoundedLocationsByZipCode | ( | const TeAddress & | address,
|  | vector< TeAddressDescription > & | addressesFound
| ) |  | `[protected]`

void TeAddressLocator::removeHifen | ( | string & | zipCode | ) | const`[protected]`

Removes hifen if remove flag is true.

void TeAddressLocator::removeSpecialCharacters | ( | string & | str | ) | const`[protected]`

Remove caracteres como ponto e troca acentuados por n�o acentuados.

bool TeAddressLocator::setAddressLocatorMetadata | ( | const TeAddressMetadata & | m | ) |

Set the metadata.

void TeAddressLocator::setCentroidAddressMetadata | ( | const TeCentroidAddressMetadata & | cMetadata | ) | `[inline]`

Information about a layer to be used as an alternative for geocoding.

void TeAddressLocator::setReplaceSpecialChars | ( | const bool & | r | ) | `[inline]`

void TeAddressLocator::setSplitChar | ( | const string & | splitChar | ) | `[inline]`

void TeAddressLocator::splitAddress | ( | TeAddress & | add | ) | `[protected]`

Split address name and number.

bool TeAddressLocator::updateAddressMetadata | ( | const TeAddressMetadata & | metadata | ) |

Updates the metadata of an attribute table layer and saves in the database.

bool TeAddressLocator::updateAddressTable | ( | const string & | c1,
|  | const int & | v1,
|  | TeGeocodeTableMetadata & | tableMetadata,
|  | const string & | objectId
| ) |  | `[protected]`

Update the table that contains address to be geocoded with the code returned by the geocoding process and a description of the process match.

bool TeAddressLocator::verifyHifen | ( | const string & | tableName,
|  | const string & | columnName
| ) |  | `[protected]`

## Member Data Documentation

bool TeAddressLocator::changeSpecialChars_`[protected]`

If true should replace special characters.

TeCentroidAddressMetadata TeAddressLocator::cmetadata_`[protected]`

Centroid metadata.

TeDatabase* TeAddressLocator::db_`[protected]`

Database connection.

TeGeocoderDictionary TeAddressLocator::dictionary_`[protected]`

Use a geocoder dictionary.

string TeAddressLocator::errMsg_`[protected]`

Error message description.

char TeAddressLocator::hifen_`[protected]`

bool TeAddressLocator::isMetadataLoaded_`[protected]`

Flag to indicate if the metadata is loaded.

TeAddressMetadata TeAddressLocator::metadata_`[protected]`

Metadata information for a geocoding base table.

vector<string> TeAddressLocator::prepositionsVector_`[protected]`

Vector with default prepositions for street names.

TeLayer* TeAddressLocator::referenceLayer_`[protected]`

Ther layer used as reference for geocoding.

bool TeAddressLocator::removeHifen_`[protected]`

If true the hifen is removed in zip code.

bool TeAddressLocator::removeHifenFromCentroid_`[protected]`

If true the hifen is removed in zip code from the centroid table.

string TeAddressLocator::splitChar_`[protected]`

Used to split address name and number.

vector<string> TeAddressLocator::titlesVector_`[protected]`

Vector with default titles for street names.

vector<string> TeAddressLocator::typesVector_`[protected]`

Vector with default types for street names.

The documentation for this class was generated from the following files:

- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/functions/TeAddressLocator.h
- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/functions/TeAddressLocator.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines