QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
QgsGeocoderResult Class Reference

Represents a matching result from a geocoder search. More...

#include <qgsgeocoderresult.h>

Public Member Functions

 QgsGeocoderResult (const QString &identifier, const QgsGeometry &geometry, const QgsCoordinateReferenceSystem &crs)
 Constructor for a valid QgsGeocoderResult, with the specified geometry and crs.
 
QVariantMap additionalAttributes () const
 Contains additional attributes generated during the geocode, which may be added to features being geocoded.
 
QgsCoordinateReferenceSystem crs () const
 Returns the coordinate reference system for the calculated geometry().
 
QString description () const
 Returns the optional description for the result.
 
QString error () const
 Returns the error string, if the result is invalid.
 
QgsGeometry geometry () const
 Returns the resultant geometry resulting from the geocoding operation.
 
QString group () const
 Returns the optional group value for the result.
 
QString identifier () const
 Returns the identifier string for the result.
 
bool isValid () const
 Returns true if the result is a valid result.
 
void setAdditionalAttributes (const QVariantMap &attributes)
 Setss additional attributes generated during the geocode, which may be added to features being geocoded.
 
void setCrs (const QgsCoordinateReferenceSystem &crs)
 Sets the coordinate reference system for the calculated geometry().
 
void setDescription (const QString &description)
 Sets an optional description for the result.
 
void setGeometry (const QgsGeometry &geometry)
 Sets the resultant geometry resulting from the geocoding operation.
 
void setGroup (const QString &group)
 Sets the optional group value for the result.
 
void setViewport (const QgsRectangle &viewport)
 Sets the suggested viewport for the result, which reflects a recommended map extent for displaying the result.
 
QgsRectangle viewport () const
 Returns the suggested viewport for the result, which reflects a recommended map extent for displaying the result.
 

Static Public Member Functions

static QgsGeocoderResult errorResult (const QString &errorMessage)
 Creates an invalid error result, with the specified errorMessage string.
 

Detailed Description

Represents a matching result from a geocoder search.

QgsGeocoderResult objects may represent valid matches, or an invalid error result. This can be checked by testing isValid(). An invalid result represents that an error was encountered while geocoding, in which case the error message can be retrieved by calling error().

Valid geocoding results will have a geometry() and crs(), along with a set of optional additionalAttributes() which may contain information such as the accuracy of the geocoding result.

Since
QGIS 3.18

Definition at line 40 of file qgsgeocoderresult.h.

Constructor & Destructor Documentation

◆ QgsGeocoderResult()

QgsGeocoderResult::QgsGeocoderResult ( const QString &  identifier,
const QgsGeometry geometry,
const QgsCoordinateReferenceSystem crs 
)

Constructor for a valid QgsGeocoderResult, with the specified geometry and crs.

Definition at line 26 of file qgsgeocoderresult.cpp.

Member Function Documentation

◆ additionalAttributes()

QVariantMap QgsGeocoderResult::additionalAttributes ( ) const
inline

Contains additional attributes generated during the geocode, which may be added to features being geocoded.

See also
setAdditionalAttributes()

Definition at line 142 of file qgsgeocoderresult.h.

◆ crs()

QgsCoordinateReferenceSystem QgsGeocoderResult::crs ( ) const
inline

Returns the coordinate reference system for the calculated geometry().

See also
setCrs()
geometry()

Definition at line 100 of file qgsgeocoderresult.h.

◆ description()

QString QgsGeocoderResult::description ( ) const

Returns the optional description for the result.

See also
setDescription()

Definition at line 43 of file qgsgeocoderresult.cpp.

◆ error()

QString QgsGeocoderResult::error ( ) const
inline

Returns the error string, if the result is invalid.

Definition at line 65 of file qgsgeocoderresult.h.

◆ errorResult()

QgsGeocoderResult QgsGeocoderResult::errorResult ( const QString &  errorMessage)
static

Creates an invalid error result, with the specified errorMessage string.

Definition at line 18 of file qgsgeocoderresult.cpp.

◆ geometry()

QgsGeometry QgsGeocoderResult::geometry ( ) const
inline

Returns the resultant geometry resulting from the geocoding operation.

The coordinate reference system for the geometry can be retrieved via crs().

See also
setGeometry()
crs()

Definition at line 81 of file qgsgeocoderresult.h.

◆ group()

QString QgsGeocoderResult::group ( ) const

Returns the optional group value for the result.

The group can be used to categorize results into different groups, e.g. by appropriate administrative region.

See also
setGroup()

Definition at line 33 of file qgsgeocoderresult.cpp.

◆ identifier()

QString QgsGeocoderResult::identifier ( ) const
inline

Returns the identifier string for the result.

Definition at line 70 of file qgsgeocoderresult.h.

◆ isValid()

bool QgsGeocoderResult::isValid ( ) const
inline

Returns true if the result is a valid result.

If the result is invalid, the error message can be retrieved by calling error().

Definition at line 60 of file qgsgeocoderresult.h.

◆ setAdditionalAttributes()

void QgsGeocoderResult::setAdditionalAttributes ( const QVariantMap &  attributes)
inline

Setss additional attributes generated during the geocode, which may be added to features being geocoded.

See also
additionalAttributes()

Definition at line 150 of file qgsgeocoderresult.h.

◆ setCrs()

void QgsGeocoderResult::setCrs ( const QgsCoordinateReferenceSystem crs)
inline

Sets the coordinate reference system for the calculated geometry().

See also
crs()
geometry()

Definition at line 108 of file qgsgeocoderresult.h.

◆ setDescription()

void QgsGeocoderResult::setDescription ( const QString &  description)

Sets an optional description for the result.

See also
description()

Definition at line 48 of file qgsgeocoderresult.cpp.

◆ setGeometry()

void QgsGeocoderResult::setGeometry ( const QgsGeometry geometry)
inline

Sets the resultant geometry resulting from the geocoding operation.

The coordinate reference system for the geometry should also be set via setCrs().

See also
geometry()
setCrs()

Definition at line 92 of file qgsgeocoderresult.h.

◆ setGroup()

void QgsGeocoderResult::setGroup ( const QString &  group)

Sets the optional group value for the result.

The group can be used to categorize results into different groups, e.g. by appropriate administrative region.

See also
group()

Definition at line 38 of file qgsgeocoderresult.cpp.

◆ setViewport()

void QgsGeocoderResult::setViewport ( const QgsRectangle viewport)
inline

Sets the suggested viewport for the result, which reflects a recommended map extent for displaying the result.

This is an optional property, and can be set to a null rectangle if a recommended viewport is not available (or not appropriate).

The viewport CRS must match the CRS of geometry()d.

See also
viewport()

Definition at line 134 of file qgsgeocoderresult.h.

◆ viewport()

QgsRectangle QgsGeocoderResult::viewport ( ) const
inline

Returns the suggested viewport for the result, which reflects a recommended map extent for displaying the result.

This is an optional property, and will return a null rectangle if a recommended viewport is not available (or not appropriate).

The viewport CRS will match the CRS of geometry(), and can be retrieved via the crs() method.

See also
setViewport()

Definition at line 121 of file qgsgeocoderresult.h.


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