PySide6.QtLocation.QGeoServiceProvider

class QGeoServiceProvider

The QGeoServiceProvider class aggregates access to services which provide geographical information. More

Inheritance diagram of PySide6.QtLocation.QGeoServiceProvider

Synopsis

Methods

Static functions

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

The Maps and Navigation API allows people to access various kinds of geographical information, including functionality to perform geocoding, routing and the display of maps. The QGeoServiceProvider aggregates the access to a set of these services that are provided by a single vendor.

It is possible to mix and match service providers for the various domains, so that a geocoding manager from one service provider can be used with a geographic routing manager from another service provider.

This is not recommended unless the client is able to verify that the data provided by the different services are compatible, as differences in the underlying data sets could cause serious incongruences between the services.

Subclasses of QGeoServiceProvider guarantee that the different services that they provide are interoperable.

Each service provider must follow a naming convention for their service specific parameter names/keys. They use the provider name as prefix for all their parameter names. When a provider is loaded only those parameters are passed on whose parameter names start with the provider name. This avoids the sharing sensitive parameters such as confidential token or app_id parameters with other plugins.

Please check the GeoServices plugin specific documentation to obtain a complete list of the available parameter names/keys and values.

class Error

Describes an error related to the loading and setup of a service provider plugin.

Constant

Description

QGeoServiceProvider.NoError

No error has occurred.

QGeoServiceProvider.NotSupportedError

The plugin does not support this functionality.

QGeoServiceProvider.UnknownParameterError

The plugin did not recognize one of the parameters it was given.

QGeoServiceProvider.MissingRequiredParameterError

The plugin did not find one of the parameters it was expecting.

QGeoServiceProvider.ConnectionError

The plugin could not connect to its backend service or database.

QGeoServiceProvider.LoaderError

The plugin failed to load.

class RoutingFeature

(inherits enum.Flag) Describes the routing features supported by the geo service provider.

Constant

Description

QGeoServiceProvider.NoRoutingFeatures

No routing features are supported.

QGeoServiceProvider.OnlineRoutingFeature

Online routing is supported.

QGeoServiceProvider.OfflineRoutingFeature

Offline routing is supported.

QGeoServiceProvider.LocalizedRoutingFeature

Supports returning routes with localized addresses and instructions.

QGeoServiceProvider.RouteUpdatesFeature

Updating an existing route based on the current position is supported.

QGeoServiceProvider.AlternativeRoutesFeature

Supports returning alternative routes.

QGeoServiceProvider.ExcludeAreasRoutingFeature

Supports specifying a areas which the returned route must not cross.

QGeoServiceProvider.AnyRoutingFeatures

Matches a geo service provider that provides any routing features.

class GeocodingFeature

(inherits enum.Flag) Describes the geocoding features supported by the geo service provider.

Constant

Description

QGeoServiceProvider.NoGeocodingFeatures

No geocoding features are supported.

QGeoServiceProvider.OnlineGeocodingFeature

Online geocoding is supported.

QGeoServiceProvider.OfflineGeocodingFeature

Offline geocoding is supported.

QGeoServiceProvider.ReverseGeocodingFeature

Reverse geocoding is supported.

QGeoServiceProvider.LocalizedGeocodingFeature

Supports returning geocoding results with localized addresses.

QGeoServiceProvider.AnyGeocodingFeatures

Matches a geo service provider that provides any geocoding features.

class MappingFeature

(inherits enum.Flag) Describes the mapping features supported by the geo service provider.

Constant

Description

QGeoServiceProvider.NoMappingFeatures

No mapping features are supported.

QGeoServiceProvider.OnlineMappingFeature

Online mapping is supported.

QGeoServiceProvider.OfflineMappingFeature

Offline mapping is supported.

QGeoServiceProvider.LocalizedMappingFeature

Supports returning localized map data.

QGeoServiceProvider.AnyMappingFeatures

Matches a geo service provider that provides any mapping features.

class PlacesFeature

(inherits enum.Flag) Describes the places features supported by the geo service provider.

Constant

Description

QGeoServiceProvider.NoPlacesFeatures

No places features are supported.

QGeoServiceProvider.OnlinePlacesFeature

Online places is supported.

QGeoServiceProvider.OfflinePlacesFeature

Offline places is supported.

QGeoServiceProvider.SavePlaceFeature

Saving places is supported.

QGeoServiceProvider.RemovePlaceFeature

Removing or deleting places is supported.

QGeoServiceProvider.SaveCategoryFeature

Saving categories is supported.

QGeoServiceProvider.RemoveCategoryFeature

Removing or deleting categories is supported.

QGeoServiceProvider.PlaceRecommendationsFeature

Searching for recommended places similar to another place is supported.

QGeoServiceProvider.SearchSuggestionsFeature

Search suggestions is supported.

QGeoServiceProvider.LocalizedPlacesFeature

Supports returning localized place data.

QGeoServiceProvider.NotificationsFeature

Notifications of place and category changes is supported.

QGeoServiceProvider.PlaceMatchingFeature

Supports matching places from two different geo service providers.

QGeoServiceProvider.AnyPlacesFeatures

Matches a geo service provider that provides any places features.

class NavigationFeature

(inherits enum.Flag) Describes the navigation features supported by the geo service provider.

Constant

Description

QGeoServiceProvider.NoNavigationFeatures

No navigation features are supported.

QGeoServiceProvider.OnlineNavigationFeature

Online navigation is supported.

QGeoServiceProvider.OfflineNavigationFeature

Offline navigation is supported.

QGeoServiceProvider.AnyNavigationFeatures

Matches a geo service provider that provides any navigation features.

__init__(providerName[, parameters=QVariantMap()[, allowExperimental=false]])
Parameters:
  • providerName – str

  • parameters – Dictionary with keys of type .QString and values of type QVariant.

  • allowExperimental – bool

Constructs a QGeoServiceProvider whose backend has the name providerName, using the provided parameters.

If multiple plugins have the same providerName, the plugin with the highest reported providerVersion() will be used.

If allowExperimental is true then plugins marked as experimental may be used. By default experimental plugins are not considered.

If no plugin matching providerName was able to be loaded then error() and errorString() will provide details about why this is the case.

Note

Before the list of parameters is passed on to the to-be-loaded provider plugin, the list is filtered to avoid the sharing of plugin specific parameters with unrelated provider plugins. Plugin specific parameter keys must be prefixed with the provider name (e.g. here.app_id).

static availableServiceProviders()
Return type:

list of strings

Returns a list of names of the available service providers, for use with the QGeoServiceProvider constructors.

error()
Return type:

Error

Returns an error code describing the error which occurred during the last operation that was performed by this class.

errorString()
Return type:

str

Returns a string describing the error which occurred during the last operation that was performed by this class.

geocodingError()
Return type:

Error

Returns an error code describing the error which occurred during the last attempt to create a geocoding manager.

geocodingErrorString()
Return type:

str

Returns a string describing the error which occurred during the last attempt to create a geocoding manager.

geocodingFeatures()
Return type:

Combination of GeocodingFeature

Returns the geocoding features supported by the geo service provider.

geocodingManager()
Return type:

QGeoCodingManager

Returns the QGeoCodingManager made available by the service provider.

This function will return None if the service provider does not provide any geocoding services.

This function will attempt to construct a QGeoCodingManager instance when it is called for the first time. If the attempt is successful the QGeoCodingManager will be cached, otherwise each call of this function will attempt to construct a QGeoCodingManager instance until the construction is successful.

The QGeoCodingManager is owned by this QGeoServiceProvider and should not be deleted separately. Users should assume that deleting the QGeoServiceProvider renders the pointer returned by this method invalid.

After this function has been called, error() and errorString() will report any errors which occurred during the construction of the QGeoCodingManager .

mappingError()
Return type:

Error

Returns an error code describing the error which occurred during the last attempt to create a mapping manager.

mappingErrorString()
Return type:

str

Returns a string describing the error which occurred during the last attempt to create a mapping manager.

mappingFeatures()
Return type:

Combination of MappingFeature

Returns the mapping features supported by the geo service provider.

navigationError()
Return type:

Error

Returns an error code describing the error which occurred during the last attempt to create a navigation manager.

navigationErrorString()
Return type:

str

Returns a string describing the error which occurred during the last attempt to create a navigation manager.

navigationFeatures()
Return type:

Combination of NavigationFeature

Returns the navigation features supported by the geo service provider.

placeManager()
Return type:

QPlaceManager

Returns the QPlaceManager made available by the service provider.

This function will attempt to construct a QPlaceManager instance when it is called for the first time. If the attempt is successful the QPlaceManager will be cached, otherwise each call of this function will attempt to construct a QPlace instance until the construction is successful.

The QGeoPlaceManager is owned by this QGeoServiceProvider and should not be deleted separately. Users should assume that deleting the QGeoServiceProvider renders the pointer returned by this method invalid.

After this function has been called, error() and errorString() will report any errors which occurred during the construction of the QPlaceManager .

placesError()
Return type:

Error

Returns an error code describing the error which occurred during the last attempt to create a places manager.

placesErrorString()
Return type:

str

Returns a string describing the error which occurred during the last attempt to create a places manager.

placesFeatures()
Return type:

Combination of PlacesFeature

Returns the places features supported by the geo service provider.

routingError()
Return type:

Error

Returns an error code describing the error which occurred during the last attempt to create a routing manager.

routingErrorString()
Return type:

str

Returns a string describing the error which occurred during the last attempt to create a routing manager.

routingFeatures()
Return type:

Combination of RoutingFeature

Returns the routing features supported by the geo service provider.

routingManager()
Return type:

QGeoRoutingManager

Returns the QGeoRoutingManager made available by the service provider.

This function will return None if the service provider does not provide any geographic routing services.

This function will attempt to construct a QGeoRoutingManager instance when it is called for the first time. If the attempt is successful the QGeoRoutingManager will be cached, otherwise each call of this function will attempt to construct a QGeoRoutingManager instance until the construction is successful.

The QGeoRoutingManager is owned by this QGeoServiceProvider and should not be deleted separately. Users should assume that deleting the QGeoServiceProvider renders the pointer returned by this method invalid.

After this function has been called, error() and errorString() will report any errors which occurred during the construction of the QGeoRoutingManager .

setAllowExperimental(allow)
Parameters:

allow – bool

Sets whether experimental plugins are considered when locating the correct plugin library for this service provider to allow.

Important: this will destroy any existing managers held by this service provider instance. You should be sure not to attempt to use any pointers that you have previously retrieved after calling this method.

setLocale(locale)
Parameters:

localeQLocale

Sets the locale used by this service provider to locale. If the relevant features (see LocalizedMappingFeature etc), this will change the languages, units and other locale-specific attributes of the provider’s data.

setParameters(parameters)
Parameters:

parameters – Dictionary with keys of type .QString and values of type QVariant.

Sets the parameters used to construct individual manager classes for this service provider to parameters.

Before the list of parameters is passed on to the to-be-loaded service provider, the list is filtered to avoid the sharing of provider specific parameters with unrelated service providers. Provider specific parameter keys must be prefixed with the provider name (e.g. here.app_id).

Important: this will destroy any existing managers held by this service provider instance. You should be sure not to attempt to use any pointers that you have previously retrieved after calling this method.

setQmlEngine(engine)
Parameters:

engineQQmlEngine