Qt Location HERE Plugin

概述

Included with Qt Location is a geo services plugin which accesses the relevant HERE services provided by HERE/Nokia. The use of these services is governed by the terms and conditions available at https://developer.here.com/terms-conditions .

Note that accepting the terms and conditions only applies those terms and conditions to the use of the HERE geo services plugin and does not limit the use of the other geo services plugins that may be included with Qt.

The HERE geo services plugin can be loaded by using the plugin key "here".

The online plugin uses the tiled map classes, which caches tile data in heap memory and texture memory.

参数

Mandatory parameters

The following table lists mandatory parameters that must be passed to the HERE plugin.

参数 描述
here.app_id Client app_id part of the app_id/token pair used for authentication by all managers.
here.token Client token part of the app_id/token pair for the service used for authentication by all managers.

The HERE geo services plugin requires an application id and token pair to authenticate the application with the HERE services. To obtain an application id and token pair visit https://developer.here.com/

可选参数

The following table lists optional parameters that can be passed to the HERE plugin.

注意: Since Qt 5.5 all parameters below must be prefixed with here . Previous versions did not require a prefix.

参数 描述
here.proxy

Proxy server URL used by all managers. For usage of the system proxy just pass "system" as value.

注意: See the notes in QNetworkProxyFactory::systemProxyForQuery () for further information.

here.mapping.host Base map tile service URL used by mapping manager.
here.mapping.host.aerial Aerial map tile service URL used by mapping manager. For all satellite, hybrid and terrain schemes.
here.mapping.cache.directory

Absolute path to map tile cache directory used as network disk cache.

The default place for the cache is the QtLocation/here subdirectory in the location returned by QStandardPaths::writableLocation (), called with QStandardPaths::GenericCacheLocation as a parameter. On systems that have no concept of a shared cache, the application-specific QStandardPaths::CacheLocation 被使用,取而代之。

here.mapping.cache.disk.cost_strategy The cost strategy to use to cache map tiles on disk. Valid values are bytesize and unitary 。使用 bytesize , the related size parameter ( here.mapping.cache.disk.size ) will be interpreted as bytes. Using unitary , they will be interpreted as number of tiles. The default value for this parameter is bytesize .
here.mapping.cache.disk.size Disk cache size for map tiles. The default size of the cache is 50 MiB when bytesize is the cost strategy for this cache, or 1000 tiles, when unitary is the cost strategy.
here.mapping.cache.memory.cost_strategy The cost strategy to use to cache map tiles in memory. Valid values are bytesize and unitary 。使用 bytesize , the related size parameter ( here.mapping.cache.memory.size ) will be interpreted as bytes. Using unitary , they will be interpreted as number of tiles. The default value for this parameter is bytesize .
here.mapping.cache.memory.size Memory cache size for map tiles. The default size of the cache is 3 MiB when bytesize is the cost strategy for this cache, or 100 tiles, when unitary is the cost strategy.
here.mapping.cache.texture.cost_strategy The cost strategy to use to cache decompressed map tiles in memory. Valid values are bytesize and unitary 。使用 bytesize , the related size parameter ( here.mapping.cache.texture.size ) will be interpreted as bytes. Using unitary , they will be interpreted as number of tiles. The default value for this parameter is bytesize .
here.mapping.cache.texture.size Texture cache size for map tiles. The default size of the cache is 6 MiB when bytesize is the cost strategy for this cache, or 30 tiles, when unitary is the cost strategy. Note that the texture cache has a hard minimum size which depends on the size of the map viewport (it must contain enough data to display the tiles currently visible on the display). This value is the amount of cache to be used in addition to the bare minimum.
here.mapping.prefetching_style This parameter allows to provide a hint how tile prefetching is to be performed by the engine. The default value, TwoNeighbourLayers , makes the engine prefetch tiles for the layer above and the one below the current tile layer, providing ready tiles when zooming in or out from the current zoom level. OneNeighbourLayer only prefetches the one layer closest to the current zoom level. Finally, NoPrefetching allows to disable the prefetching, so only tiles that are visible will be fetched. Note that, depending on the active map type, this hint might be ignored.
here.mapping.highdpi_tiles Whether or not to request high dpi tiles. Valid values are true and false 。默认值为 false .
here.geocoding.host Geocoding service URL used by geocoding manager.
here.routing.host Routing service URL used by routing manager.
here.places.host Search service URL used by search manager.
here.places.api_version Version of the REST API used by the places manager. Currently versions 1 and 2 are supported. The version 1 is deprecated and will not be part of the final Qt release. The default is version 2.

参数用法范例

The following two examples show how to create a HERE plugin instance with parameters supplied for an application id and token, which is required for authentication.

QML

Plugin {
    name: "here"
    PluginParameter { name: "here.app_id"; value: "myapp" }
    PluginParameter { name: "here.token"; value: "abcdefg12345" }
}
							

C++

QMap<QString,QVariant> params;
params["here.app_id"] = "myapp";
params["here.token"] = "abcdefg12345";
QGeoServiceProvider *gsp = new QGeoServiceProvider("here", params);
					
							

Places

The HERE provider remotely accesses places (read-only) from a REST based server. The specific capabilities and behaviours are outlined below:

Capabilities

Storage remote
读/写 只读
图标 yes
Search term suggestions yes
Recommendations yes
Category structure Hierarchical
(Rich) Content images yes
(Rich) Content reviews yes
(Rich) Content editorials yes
All details fetched during search no
Paging offset index no
Paging limit yes
Distance relevance hint no
Lexical name relevance hint no
Extended Attributes yes
Notifications for added/removed places/categories no
visibility scopes public
favorites matching/(usable as favoritesPlugin) no

Plugin Specific Behaviors and Limitations.

Search

The following list shows what core place data is returned during a place search:

  • 名称
  • location
  • contact information
  • attribution
  • categories
  • rating
  • visibility

The following list shows further details that may be retrieved via QPlaceManager::getDetails()

  • supplier
  • extended attributes

Searching for Places

Search Term and Categories

The HERE plugin supports searching with a search term and category or categories , however both are not supported simultaneously.

  • Valid usage: search term + search center
  • Valid usage: category + search center
  • Invalid usage: search term + category + search center

This limitation applies when using the HERE plugin with PlaceSearchModel and QPlaceManager::search ().

Search Area

The HERE plugin only supports provision of a search center when searching for places via PlaceSearchModel and QPlaceManager::search (). A search center can be provided via a bounding circle, however the radius should be kept at the default value of -1. Typically a developer should not have to set the radius at all. If a developer sets a radius, it is ignored by the plugin and the boundaries are not honored.

In a similar manner only the center of a bounding box is taken into consideration when searching. The boundaries of the box are not honored.

A search center must be provided for all searches.

Relevancy Hints

The HERE plugin does not support relevancy hints. Any relevancy hints supplied to a search request are consequently ignored.

Search Term suggestions

Only a partial search term and search center is supported when retrieving suggestions. This limitation applies when using the HERE plugin with the PlaceSearchSuggestionModel and QPlaceManager::searchSuggestions ().

Both search term and search center must be provided when retrieving search term suggestions.

Recommendations

Only a given place identifier is supported as a parameter for a recommendations. No other parameters such as limit, offset, and search area are supported. This limitation applies when using the HERE plugin with PlaceSearchModel and QPlaceManager::search ().

Extended Attributes

The supported set of attributes provided by the HERE plugin are not fixed and may grow over time. Also the attributes provided may vary according to a place by place basis, e.g one place may provide opening hours while another does not. At the time of writing, it is known that some places provide openingHours ( QPlaceAttribute::OpeningHours ) 和 payment ( QPlaceAttribute::Payment ) methods but other attributes may be made available by the backend server. All places provided by the plugin will have the x_provider ( QPlaceAttribute::Provider ) attribute set to here .

Restrictions of Usage - ExtendedAttributes and Content

The extended attributes and rich content of places are not permitted to be saved. For QML this is related to Place::extendedAttributes , ImageModel , ReviewModel ,和 EditorialModel . For C++ this relates to QPlace::extendedAttribute (), QPlace::content () 和 QPlaceManager::getPlaceContent ().

(Note that the HERE plugin is a read-only source of places and does not support saving functionality at all.)