Class: QgsGeocoderResult¶
- class qgis.core.QgsGeocoderResult¶
Bases:
sip.wrapper
Represents a matching result from a geocoder search.
QgsGeocoderResult
objects may represent valid matches, or an invalid error result. This can be checked by testingisValid()
. An invalid result represents that an error was encountered while geocoding, in which case the error message can be retrieved by callingerror()
.Valid geocoding results will have a
geometry()
andcrs()
, along with a set of optionaladditionalAttributes()
which may contain information such as the accuracy of the geocoding result.New in version 3.18.
QgsGeocoderResult(identifier: str, geometry:
QgsGeometry
, crs:QgsCoordinateReferenceSystem
) Constructor for a validQgsGeocoderResult
, with the specifiedgeometry
andcrs
.QgsGeocoderResult(
QgsGeocoderResult
)Methods
Contains additional attributes generated during the geocode, which may be added to features being geocoded.
Returns the coordinate reference system for the calculated
geometry()
.Returns the optional description for the result.
Returns the error string, if the result is invalid.
Creates an invalid error result, with the specified
errorMessage
string.Returns the resultant geometry resulting from the geocoding operation.
Returns the optional group value for the result.
Returns the identifier string for the result.
Returns
True
if the result is a valid result.Setss additional attributes generated during the geocode, which may be added to features being geocoded.
Sets the coordinate reference system for the calculated
geometry()
.Sets an optional
description
for the result.Sets the resultant
geometry
resulting from the geocoding operation.Sets the optional
group
value for the result.Sets the suggested
viewport
for the result, which reflects a recommended map extent for displaying the result.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.
See also
- Return type:
Dict[str, Any]
- crs(self) QgsCoordinateReferenceSystem ¶
Returns the coordinate reference system for the calculated
geometry()
.See also
See also
- Return type:
- description(self) str ¶
Returns the optional description for the result.
See also
- 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:
- 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
See also
- Return type:
- 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
- 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.
See also
- Parameters:
attributes (Dict[str) –
- setCrs(self, crs: QgsCoordinateReferenceSystem)¶
Sets the coordinate reference system for the calculated
geometry()
.See also
See also
- Parameters:
crs (QgsCoordinateReferenceSystem) –
- setDescription(self, description: str)¶
Sets an optional
description
for the result.See also
- 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
See also
- 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
- 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
- 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 thecrs()
method.See also
- Return type: