Class: QgsGeocoderInterface¶
Interface for geocoders.
QgsGeocoderInterface
implementations are able to take either
a QgsFeature
or a free-form string and calculate the
corresponding geometry of the feature.
Added in version 3.18.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: flags()
Class Hierarchy¶
Subclasses¶
A geocoder which uses the Google Map geocoding API to retrieve results. |
|
A geocoder which uses the Nominatim geocoding API to retrieve results. |
Enums
Capability flags for the geocoder. |
Abstract Methods
Returns the geocoder's capability flags. |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsGeocoderInterface. See the FAQ for more details.
Returns a set of newly created fields which will be appended to existing features during the geocode operation. |
|
Geocodes a feature. |
|
Geocodes a string. |
|
Returns the WKB type of geometries returned by the geocoder. |
- class qgis.core.QgsGeocoderInterface[source]¶
Bases:
object
- class Flag(*values)¶
Bases:
IntEnum
Capability flags for the geocoder.
GeocodesStrings
: Can geocode string input valuesGeocodesFeatures
: Can geocodeQgsFeature
input values
- GeocodesFeatures = 2¶
- GeocodesStrings = 1¶
- class Flags¶
- class Flags(f: QgsGeocoderInterface.Flags | QgsGeocoderInterface.Flag)
- class Flags(a0: QgsGeocoderInterface.Flags)
Bases:
object
- virtual appendedFields(self) QgsFields [source]¶
Returns a set of newly created fields which will be appended to existing features during the geocode operation.
These fields will include any extra content returned by the geocoder, such as fields for accuracy of the match or correct attribute values.
- Return type:
- abstract flags(self) QgsGeocoderInterface.Flags [source]¶
Returns the geocoder’s capability flags.
- Return type:
- virtual geocodeFeature(self, feature: QgsFeature, context: QgsGeocoderContext, feedback: QgsFeedback | None = None) List[QgsGeocoderResult] ¶
Geocodes a
feature
.If implemented by the geocoder (i.e.
flags()
returns the QgsGeocoderInterface.Flag.GeocodesFeatures flag), a list of matching results will be returned.The optional
feedback
argument can be used to provider cancellation support.- Parameters:
feature (QgsFeature)
context (QgsGeocoderContext)
feedback (Optional[QgsFeedback] = None)
- Return type:
List[QgsGeocoderResult]
- virtual geocodeString(self, string: str | None, context: QgsGeocoderContext, feedback: QgsFeedback | None = None) List[QgsGeocoderResult] ¶
Geocodes a
string
.If implemented by the geocoder (i.e.
flags()
returns the QgsGeocoderInterface.Flag.GeocodesStrings flag), a list of matching results will be returned.The optional
feedback
argument can be used to provider cancellation support.- Parameters:
string (Optional[str])
context (QgsGeocoderContext)
feedback (Optional[QgsFeedback] = None)
- Return type:
List[QgsGeocoderResult]
- virtual wkbType(self) Qgis.WkbType [source]¶
Returns the WKB type of geometries returned by the geocoder.
If this is not known in advance then
QgsWkbTypes
.Unknown should be returned (e.g. in the case that a geocoder may return different geometry types depending on the quality of the match).- Return type: