QGeoServiceProviderclass aggregates access to services which provide geographical information. 更多 …
def
error
()
def
errorString
()
def
geocodingError
()
def
geocodingErrorString
()
def
geocodingFeatures
()
def
geocodingManager
()
def
mappingError
()
def
mappingErrorString
()
def
mappingFeatures
()
def
navigationError
()
def
navigationErrorString
()
def
navigationFeatures
()
def
placeManager
()
def
placesError
()
def
placesErrorString
()
def
placesFeatures
()
def
routingError
()
def
routingErrorString
()
def
routingFeatures
()
def
routingManager
()
def
setAllowExperimental
(allow)
def
setLocale
(locale)
def
setParameters
(parameters)
def
setQmlEngine
(engine)
def
availableServiceProviders
()
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.
子类化的
QGeoServiceProviderguarantee that the different services that they provide are interoperable.At this point there are two GeoServices plugins packaged with Qt. They are accessible using their provider names:
“mapbox” -> Mapbox service
“here” -> HERE Services
“osm” -> OpenStreetMap Services
“esri” -> ESRI Services
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. For example, the HERE service provider requires the
here.app_idparameter. 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 confidentialtokenorapp_idparameters with other plugins.Please check the GeoServices plugin specific documentation to obtain a complete list of the available parameter names/keys and values.
QGeoServiceProvider
(
providerName
[
,
parameters=QVariantMap()
[
,
allowExperimental=false
]
]
)
¶
- param providerName
unicode
- param allowExperimental
bool- param parameters
构造
QGeoServiceProvider
whose backend has the name
providerName
,使用提供
参数
.
If multiple plugins have the same
providerName
, the plugin with the highest reported providerVersion() will be used.
若
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.
注意
Before the list of
参数
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
).
PySide2.QtLocation.QGeoServiceProvider.
Error
¶
Describes an error related to the loading and setup of a service provider plugin.
|
常量 |
描述 |
|---|---|
|
QGeoServiceProvider.NoError |
没有发生错误。 |
|
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. |
PySide2.QtLocation.QGeoServiceProvider.
RoutingFeature
¶
Describes the routing features supported by the geo service provider.
|
常量 |
描述 |
|---|---|
|
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. |
PySide2.QtLocation.QGeoServiceProvider.
GeocodingFeature
¶
Describes the geocoding features supported by the geo service provider.
|
常量 |
描述 |
|---|---|
|
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. |
PySide2.QtLocation.QGeoServiceProvider.
MappingFeature
¶
Describes the mapping features supported by the geo service provider.
|
常量 |
描述 |
|---|---|
|
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. |
PySide2.QtLocation.QGeoServiceProvider.
PlacesFeature
¶
Describes the places features supported by the geo service provider.
|
常量 |
描述 |
|---|---|
|
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. |
Describes the navigation features supported by the geo service provider.
|
常量 |
描述 |
|---|---|
|
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. |
PySide2.QtLocation.QGeoServiceProvider.
availableServiceProviders
(
)
¶
字符串列表
Returns a list of names of the available service providers, for use with the
QGeoServiceProvider
构造函数。
PySide2.QtLocation.QGeoServiceProvider.
error
(
)
¶
Returns an error code describing the error which occurred during the last operation that was performed by this class.
PySide2.QtLocation.QGeoServiceProvider.
errorString
(
)
¶
unicode
Returns a string describing the error which occurred during the last operation that was performed by this class.
PySide2.QtLocation.QGeoServiceProvider.
geocodingError
(
)
¶
Returns an error code describing the error which occurred during the last attempt to create a geocoding manager.
PySide2.QtLocation.QGeoServiceProvider.
geocodingErrorString
(
)
¶
unicode
Returns a string describing the error which occurred during the last attempt to create a geocoding manager.
PySide2.QtLocation.QGeoServiceProvider.
geocodingFeatures
(
)
¶
GeocodingFeatures
Returns the geocoding features supported by the geo service provider.
PySide2.QtLocation.QGeoServiceProvider.
geocodingManager
(
)
¶
QGeoCodingManager
返回
QGeoCodingManager
made available by the service provider.
This function will return 0 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.
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
.
PySide2.QtLocation.QGeoServiceProvider.
mappingError
(
)
¶
Returns an error code describing the error which occurred during the last attempt to create a mapping manager.
PySide2.QtLocation.QGeoServiceProvider.
mappingErrorString
(
)
¶
unicode
Returns a string describing the error which occurred during the last attempt to create a mapping manager.
PySide2.QtLocation.QGeoServiceProvider.
mappingFeatures
(
)
¶
MappingFeatures
Returns the mapping features supported by the geo service provider.
Returns an error code describing the error which occurred during the last attempt to create a navigation manager.
unicode
Returns a string describing the error which occurred during the last attempt to create a navigation manager.
NavigationFeatures
Returns the navigation features supported by the geo service provider.
PySide2.QtLocation.QGeoServiceProvider.
placeManager
(
)
¶
QPlaceManager
返回
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
.
PySide2.QtLocation.QGeoServiceProvider.
placesError
(
)
¶
Returns an error code describing the error which occurred during the last attempt to create a places manager.
PySide2.QtLocation.QGeoServiceProvider.
placesErrorString
(
)
¶
unicode
Returns a string describing the error which occurred during the last attempt to create a places manager.
PySide2.QtLocation.QGeoServiceProvider.
placesFeatures
(
)
¶
PlacesFeatures
Returns the places features supported by the geo service provider.
PySide2.QtLocation.QGeoServiceProvider.
routingError
(
)
¶
Returns an error code describing the error which occurred during the last attempt to create a routing manager.
PySide2.QtLocation.QGeoServiceProvider.
routingErrorString
(
)
¶
unicode
Returns a string describing the error which occurred during the last attempt to create a routing manager.
PySide2.QtLocation.QGeoServiceProvider.
routingFeatures
(
)
¶
RoutingFeatures
Returns the routing features supported by the geo service provider.
PySide2.QtLocation.QGeoServiceProvider.
routingManager
(
)
¶
QGeoRoutingManager
返回
QGeoRoutingManager
made available by the service provider.
This function will return 0 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.
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
.
PySide2.QtLocation.QGeoServiceProvider.
setAllowExperimental
(
allow
)
¶
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.
PySide2.QtLocation.QGeoServiceProvider.
setLocale
(
locale
)
¶
locale
–
QLocale
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.
PySide2.QtLocation.QGeoServiceProvider.
setParameters
(
参数
)
¶
参数 –
Sets the parameters used to construct individual manager classes for this service provider to
参数
.
Before the list of
参数
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.
PySide2.QtLocation.QGeoServiceProvider.
setQmlEngine
(
engine
)
¶
engine
–
QQmlEngine