PySide6.QtLocation.QGeoServiceProvider¶
- class QGeoServiceProvider¶
The
QGeoServiceProviderclass aggregates access to services which provide geographical information. More…Synopsis¶
Methods¶
def
__init__()def
error()def
errorString()def
geocodingError()def
mappingError()def
placeManager()def
placesError()def
placesFeatures()def
routingError()def
routingManager()def
setLocale()def
setParameters()def
setQmlEngine()
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
QGeoServiceProvideraggregates 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
QGeoServiceProviderguarantee 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
tokenorapp_idparameters 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.Error.NoError
No error has occurred.
QGeoServiceProvider.Error.NotSupportedError
The plugin does not support this functionality.
QGeoServiceProvider.Error.UnknownParameterError
The plugin did not recognize one of the parameters it was given.
QGeoServiceProvider.Error.MissingRequiredParameterError
The plugin did not find one of the parameters it was expecting.
QGeoServiceProvider.Error.ConnectionError
The plugin could not connect to its backend service or database.
QGeoServiceProvider.Error.LoaderError
The plugin failed to load.
- class RoutingFeature¶
(inherits
enum.Flag) Describes the routing features supported by the geo service provider.Constant
Description
QGeoServiceProvider.RoutingFeature.NoRoutingFeatures
No routing features are supported.
QGeoServiceProvider.RoutingFeature.OnlineRoutingFeature
Online routing is supported.
QGeoServiceProvider.RoutingFeature.OfflineRoutingFeature
Offline routing is supported.
QGeoServiceProvider.RoutingFeature.LocalizedRoutingFeature
Supports returning routes with localized addresses and instructions.
QGeoServiceProvider.RoutingFeature.RouteUpdatesFeature
Updating an existing route based on the current position is supported.
QGeoServiceProvider.RoutingFeature.AlternativeRoutesFeature
Supports returning alternative routes.
QGeoServiceProvider.RoutingFeature.ExcludeAreasRoutingFeature
Supports specifying a areas which the returned route must not cross.
QGeoServiceProvider.RoutingFeature.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.GeocodingFeature.NoGeocodingFeatures
No geocoding features are supported.
QGeoServiceProvider.GeocodingFeature.OnlineGeocodingFeature
Online geocoding is supported.
QGeoServiceProvider.GeocodingFeature.OfflineGeocodingFeature
Offline geocoding is supported.
QGeoServiceProvider.GeocodingFeature.ReverseGeocodingFeature
Reverse geocoding is supported.
QGeoServiceProvider.GeocodingFeature.LocalizedGeocodingFeature
Supports returning geocoding results with localized addresses.
QGeoServiceProvider.GeocodingFeature.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.MappingFeature.NoMappingFeatures
No mapping features are supported.
QGeoServiceProvider.MappingFeature.OnlineMappingFeature
Online mapping is supported.
QGeoServiceProvider.MappingFeature.OfflineMappingFeature
Offline mapping is supported.
QGeoServiceProvider.MappingFeature.LocalizedMappingFeature
Supports returning localized map data.
QGeoServiceProvider.MappingFeature.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.PlacesFeature.NoPlacesFeatures
No places features are supported.
QGeoServiceProvider.PlacesFeature.OnlinePlacesFeature
Online places is supported.
QGeoServiceProvider.PlacesFeature.OfflinePlacesFeature
Offline places is supported.
QGeoServiceProvider.PlacesFeature.SavePlaceFeature
Saving places is supported.
QGeoServiceProvider.PlacesFeature.RemovePlaceFeature
Removing or deleting places is supported.
QGeoServiceProvider.PlacesFeature.SaveCategoryFeature
Saving categories is supported.
QGeoServiceProvider.PlacesFeature.RemoveCategoryFeature
Removing or deleting categories is supported.
QGeoServiceProvider.PlacesFeature.PlaceRecommendationsFeature
Searching for recommended places similar to another place is supported.
QGeoServiceProvider.PlacesFeature.SearchSuggestionsFeature
Search suggestions is supported.
QGeoServiceProvider.PlacesFeature.LocalizedPlacesFeature
Supports returning localized place data.
QGeoServiceProvider.PlacesFeature.NotificationsFeature
Notifications of place and category changes is supported.
QGeoServiceProvider.PlacesFeature.PlaceMatchingFeature
Supports matching places from two different geo service providers.
QGeoServiceProvider.PlacesFeature.AnyPlacesFeatures
Matches a geo service provider that provides any places features.
(inherits
enum.Flag) Describes the navigation features supported by the geo service provider.Constant
Description
QGeoServiceProvider.NavigationFeature.NoNavigationFeatures
No navigation features are supported.
QGeoServiceProvider.NavigationFeature.OnlineNavigationFeature
Online navigation is supported.
QGeoServiceProvider.NavigationFeature.OfflineNavigationFeature
Offline navigation is supported.
QGeoServiceProvider.NavigationFeature.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
QGeoServiceProviderwhose backend has the nameproviderName, using the providedparameters.If multiple plugins have the same
providerName, the plugin with the highest reported providerVersion() will be used.If
allowExperimentalis true then plugins marked as experimental may be used. By default experimental plugins are not considered.If no plugin matching
providerNamewas able to be loaded thenerror()anderrorString()will provide details about why this is the case.Note
Before the list of
parametersis 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
QGeoServiceProviderconstructors.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.
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:
Returns the
QGeoCodingManagermade available by the service provider.This function will return
Noneif the service provider does not provide any geocoding services.This function will attempt to construct a
QGeoCodingManagerinstance when it is called for the first time. If the attempt is successful theQGeoCodingManagerwill be cached, otherwise each call of this function will attempt to construct aQGeoCodingManagerinstance until the construction is successful.The
QGeoCodingManageris owned by thisQGeoServiceProviderand should not be deleted separately. Users should assume that deleting theQGeoServiceProviderrenders the pointer returned by this method invalid.After this function has been called,
error()anderrorString()will report any errors which occurred during the construction of theQGeoCodingManager.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.
- Return type:
Returns an error code describing the error which occurred during the last attempt to create a navigation manager.
- Return type:
str
Returns a string describing the error which occurred during the last attempt to create a navigation manager.
- Return type:
Combination of
NavigationFeature
Returns the navigation features supported by the geo service provider.
- placeManager()¶
- Return type:
Returns the
QPlaceManagermade available by the service provider.This function will attempt to construct a
QPlaceManagerinstance when it is called for the first time. If the attempt is successful theQPlaceManagerwill be cached, otherwise each call of this function will attempt to construct aQPlaceinstance until the construction is successful.The QGeoPlaceManager is owned by this
QGeoServiceProviderand should not be deleted separately. Users should assume that deleting theQGeoServiceProviderrenders the pointer returned by this method invalid.After this function has been called,
error()anderrorString()will report any errors which occurred during the construction of theQPlaceManager.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.
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:
Returns the
QGeoRoutingManagermade available by the service provider.This function will return
Noneif the service provider does not provide any geographic routing services.This function will attempt to construct a
QGeoRoutingManagerinstance when it is called for the first time. If the attempt is successful theQGeoRoutingManagerwill be cached, otherwise each call of this function will attempt to construct aQGeoRoutingManagerinstance until the construction is successful.The
QGeoRoutingManageris owned by thisQGeoServiceProviderand should not be deleted separately. Users should assume that deleting theQGeoServiceProviderrenders the pointer returned by this method invalid.After this function has been called,
error()anderrorString()will report any errors which occurred during the construction of theQGeoRoutingManager.- 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.
Sets the locale used by this service provider to
locale. If the relevant features (seeLocalizedMappingFeatureetc), 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
parametersis 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:
engine –
QQmlEngine