Class: QgsGeocoderResult

class qgis.core.QgsGeocoderResult(identifier: str, geometry: QgsGeometry, crs: QgsCoordinateReferenceSystem)

Bases: sip.wrapper

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

QgsGeocoderResult(QgsGeocoderResult)

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.

Methods

additionalAttributes

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

crs

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

description

Returns the optional description for the result.

error

Returns the error string, if the result is invalid.

errorResult

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

geometry

Returns the resultant geometry resulting from the geocoding operation.

group

Returns the optional group value for the result.

identifier

Returns the identifier string for the result.

isValid

Returns True if the result is a valid result.

setAdditionalAttributes

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

setCrs

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

setDescription

Sets an optional description for the result.

setGeometry

Sets the resultant geometry resulting from the geocoding operation.

setGroup

Sets the optional group value for the result.

setViewport

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

viewport

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

additionalAttributes(self)Dict[str, Any]

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

Return type

Dict[str, Any]

crs(self)QgsCoordinateReferenceSystem

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

See also

setCrs()

See also

geometry()

Return type

QgsCoordinateReferenceSystem

description(self)str

Returns the optional description for the result.

See also

setDescription()

Return type

str

error(self)str

Returns the error string, if the result is invalid.

Return type

str

errorResult(errorMessage: str)QgsGeocoderResult

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

Parameters

errorMessage (str) –

Return type

QgsGeocoderResult

geometry(self)QgsGeometry

Returns the resultant geometry resulting from the geocoding operation.

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

See also

setGeometry()

See also

crs()

Return type

QgsGeometry

group(self)str

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()

Return type

str

identifier(self)str

Returns the identifier string for the result.

Return type

str

isValid(self)bool

Returns True if the result is a valid result.

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

Return type

bool

setAdditionalAttributes(self, attributes: Dict[str, Any])

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

Parameters

attributes (Dict[str) –

setCrs(self, crs: QgsCoordinateReferenceSystem)

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

See also

crs()

See also

geometry()

Parameters

crs (QgsCoordinateReferenceSystem) –

setDescription(self, description: str)

Sets an optional description for the result.

See also

description()

Parameters

description (str) –

setGeometry(self, geometry: QgsGeometry)

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()

See also

setCrs()

Parameters

geometry (QgsGeometry) –

setGroup(self, group: str)

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()

Parameters

group (str) –

setViewport(self, viewport: QgsRectangle)

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()

Parameters

viewport (QgsRectangle) –

viewport(self)QgsRectangle

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()

Return type

QgsRectangle