Class: QgsAbstractGeocoderLocatorFilter¶
- class qgis.core.QgsAbstractGeocoderLocatorFilter¶
Bases:
QgsLocatorFilter
An abstract base class which implements a locator filter populated from a
QgsGeocoderInterface
.This base class implements the required logic to bridge a class which implements the
QgsGeocoderInterface
interface to aQgsLocatorFilter
. It allows easy creation of a locator filter from a geocoder.Note
This is a low-level API, designed for use by client applications which do not utilize the QGIS gui library. Usually the concrete class
QgsGeocoderLocatorFilter
from the gui library should be used instead.New in version 3.18.
QgsAbstractGeocoderLocatorFilter(name: str, displayName: str, prefix: str, geocoder:
QgsGeocoderInterface
, boundingBox:QgsRectangle
= QgsRectangle()) Constructor for QgsAbstractGeocoderLocatorFilter.The
name
argument specifies a unique name for the filter. This should be an untranslated string identifying the filter.The
displayName
argument must specify a translated, user-friendly name for the filter.The
prefix
argument specifies the prefix character(s) for this filter. Prefixing a search with these characters will restrict the locator search to only include results from this filter. Theprefix
must consist of at least three characters.The
geocoder
must specify an instance of a class which implements theQgsGeocoderInterface
interface. Ownership ofgeocoder
is not transferred, and the caller must ensure thatgeocoder
exists for the lifetime of this filter.The
boundingBox
argument specifies the geographic bounding box, in WGS84, covered by the filter.Methods
Returns the WGS84 bounding box attached to the filter.
- rtype
str
- param string
Returns the geocoder attached to the filter.
Converts a geocoder
result
to a locator result.Converts a locator
result
to a geocoder result.- rtype
str
- rtype
str
- param result
- boundingBox(self) QgsRectangle ¶
Returns the WGS84 bounding box attached to the filter.
- Return type
- displayName(self) str ¶
- Return type
str
- fetchResults(self, string: str, context: QgsLocatorContext, feedback: QgsFeedback)¶
- Parameters
string (str) –
context (QgsLocatorContext) –
feedback (QgsFeedback) –
- geocoder(self) QgsGeocoderInterface ¶
Returns the geocoder attached to the filter.
- Return type
- geocoderResultToLocatorResult(self, result: QgsGeocoderResult) QgsLocatorResult ¶
Converts a geocoder
result
to a locator result.See also
- Parameters
result (QgsGeocoderResult) –
- Return type
- locatorResultToGeocoderResult(self, result: QgsLocatorResult) QgsGeocoderResult ¶
Converts a locator
result
to a geocoder result.See also
- Parameters
result (QgsLocatorResult) –
- Return type
- name(self) str ¶
- Return type
str
- prefix(self) str ¶
- Return type
str
- triggerResult(self, result: QgsLocatorResult)¶
- Parameters
result (QgsLocatorResult) –