A basemap is a non-editable layer that provides background, or reference information, in your map or scene. More...
Header: | #include <Basemap.h> |
Since: | Esri::ArcGISRuntime 100.0 |
Inherits: | Esri::ArcGISRuntime::Object, Esri::ArcGISRuntime::ApiKeyResource, Esri::ArcGISRuntime::Loadable, Esri::ArcGISRuntime::JsonSerializable, and Esri::ArcGISRuntime::RemoteResource |
Public Functions
Basemap(QObject *parent = nullptr) | |
Basemap(Esri::ArcGISRuntime::Item *item, QObject *parent = nullptr) | |
Basemap(const QUrl &url, QObject *parent = nullptr) | |
Basemap(Esri::ArcGISRuntime::Layer *baseLayer, QObject *parent = nullptr) | |
Basemap(Esri::ArcGISRuntime::BasemapStyle basemapStyle, QObject *parent = nullptr) | |
Basemap(Esri::ArcGISRuntime::BasemapStyle basemapStyle, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr) | |
Basemap(const QList<Esri::ArcGISRuntime::Layer *> &baseLayers, const QList<Esri::ArcGISRuntime::Layer *> &referenceLayers, QObject *parent = nullptr) | |
Basemap(Esri::ArcGISRuntime::BasemapStyle basemapStyle, Esri::ArcGISRuntime::BasemapStyleParameters *basemapStyleParameters, QObject *parent = nullptr) | |
virtual | ~Basemap() override |
Esri::ArcGISRuntime::LayerListModel * | baseLayers() const |
Esri::ArcGISRuntime::Basemap * | clone(QObject *parent = nullptr) const |
Esri::ArcGISRuntime::Item * | item() const |
QString | name() const |
Esri::ArcGISRuntime::LayerListModel * | referenceLayers() const |
void | setName(const QString &name) |
Reimplemented Public Functions
virtual QString | apiKey() const override |
virtual void | cancelLoad() override |
virtual Esri::ArcGISRuntime::Credential * | credential() const override |
virtual void | load() override |
virtual Esri::ArcGISRuntime::Error | loadError() const override |
virtual Esri::ArcGISRuntime::LoadStatus | loadStatus() const override |
virtual Esri::ArcGISRuntime::RequestConfiguration | requestConfiguration() const override |
virtual void | retryLoad() override |
virtual void | setApiKey(const QString &apiKey) override |
virtual void | setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration) override |
virtual QString | toJson() const override |
virtual QJsonObject | unknownJson() const override |
virtual QJsonObject | unsupportedJson() const override |
virtual QUrl | url() const override |
Signals
void | doneLoading(const Esri::ArcGISRuntime::Error &loadError) |
void | loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus) |
Static Public Members
Esri::ArcGISRuntime::Basemap * | fromJson(const QString &json, QObject *parent = nullptr) |
Detailed Description
A basemap provides a background of geographical context for the content you display in a map or scene. It provides a visual reference to help orient users and a framework on which you can overlay operational layers, perform analysis, and visualize geographic information. The content of a basemap is typically static and does not change frequently.
A basemap is composed of a collection of base layers (baseLayers) and reference layers (referenceLayers). Base layers are displayed at the bottom of a map or scene, and reference layers are displayed at the top, with the GeoModel::operationalLayers between them.
Typically, you construct a basemap using a basemap style:
- Use image tile basemap styles for satellite imagery and hillshade.
- Use vector tile basemap styles such as streets navigation, light gray canvas, and OpenStreetMap (OSM).
- Create custom basemap styles with your own colors, glyphs, and fonts using the ArcGIS Vector Tile Style Editor.
See BasemapStyle for the full range of the basemap styles provided by Esri. Basemap styles allow you to take advantage of geographically load-balanced services and monitor usage with API keys or an authenticated user accounts. See Basemap layers for more information.
If your app works offline, you can construct a local basemap from a tiled layer using a TileCache, such as a tile package (.tpk, .tpkx, .vtpk) or a compact cache, stored on the device.
auto* tiledLayer = new ArcGISTiledLayer(streetMapServiceUrl, this); auto* basemap = new Basemap(tiledLayer, this); Map* map = new Map(basemap, this);
Relevant samples:
- ArcGIS map image layer (URL): Display a layer from an ArcGIS map image layer service.
- ArcGIS tiled layer (tile cache): Load an offline copy of a tiled map service as a basemap.
- ArcGIS tiled layer (URL): Load an ArcGIS tiled layer from a URL.
- Blend raster layer: Blend a hillshade with a raster by specifying the elevation data. The resulting raster looks similar to the original raster, but with some terrain shading, giving it a textured look.
- Configure basemap style parameters: Apply basemap style parameters customization for a basemap, such as displaying all labels in a specific language or displaying every label in their corresponding local language.
- Create and save map: Create and save a map as an ArcGIS `PortalItem` (i.e. web map).
- Display a scene layer: Add a scene layer to a scene.
- Filter features in scene: Filter 3D scene features out of a given geometry with a polygon filter.
- Hillshade renderer: Apply a hillshade renderer to a raster.
- Min-Max scale: Restrict zooming between specific scale ranges.
- Offline routing: This sample demonstrates how to solve a route on-the-fly using offline data.
- OpenStreetMap layer: Add OpenStreetMap as a basemap layer.
- Reverse geocode: Use an online service to find the address for a tapped point.
- RGB renderer: Apply an RGB renderer to a raster layer to enhance feature visibility.
- Set initial map area: Display a map with a predefined initial extent.
- Set initial map location: Display a basemap centered at an initial location and scale.
- Set map spatial reference: Specify a map's spatial reference.
- Vector tiled layer (URL): Load an ArcGIS Vector Tiled Layer from a URL.
- Web tiled layer: Display a tiled web layer.
See also BasemapStyle.
Member Function Documentation
[explicit]
Basemap::Basemap(QObject *parent = nullptr)
Creates a basemap. Layers need to be added to the basemap before it can be used.
- parent - The optional parent QObject.
[explicit]
Basemap::Basemap(Esri::ArcGISRuntime::Item *item, QObject *parent = nullptr)
Creates a basemap with a portal item of type PortalItemType::WebMap.
- item - A web map PortalItem.
- parent - The optional parent QObject.
The PortalItem automatically loads when the Basemap loads. If the loaded Item is not a portal item of type PortalItemType::WebMap, the basemap fails to load.
[explicit]
Basemap::Basemap(const QUrl &url, QObject *parent = nullptr)
Creates a basemap with the URL.
- url - URL of the basemap, commonly the URL of a web map portal item.
- parent - The optional parent QObject.
If the specified URL is a portal item URL (see PortalItem::PortalItem(const QUrl&, QObject*) for the supported URL formats), the underlying PortalItem will be created and accessible through item.
The URL can be one of three possible types:
- The item details page : https://www.myPortal.com/home/item.html?id=12345678901234567890123456789012
- The map view page : https://www.myPortal.com/home/webmap/viewer.html?webmap=12345678901234567890123456789012
- The sharing data page : https://www.myPortal.com/sharing/rest/content/items/12345678901234567890123456789012/data
{PortalItem::PortalItem(const QUrl&, QObject*)}, {Esri::ArcGISRuntime::Basemap::item} {item}
See also PortalItem and Esri::ArcGISRuntime::PortalItem::PortalItem(const QUrl&, QObject*).
[explicit]
Basemap::Basemap(Esri::ArcGISRuntime::Layer *baseLayer , QObject *parent = nullptr)
Creates a basemap with a single base layer.
- baseLayer - A layer object.
- parent - The optional parent QObject.
[explicit, since Esri::ArcGISRuntime 100.10]
Basemap::Basemap(Esri::ArcGISRuntime::BasemapStyle basemapStyle , QObject *parent = nullptr)
Creates a basemap with a BasemapStyle. These basemaps are secured and access requires either an API key or an authenticated user account.
- basemapStyle - The basemap style.
- parent - The optional parent QObject.
This function was introduced in Esri::ArcGISRuntime 100.10.
See also BasemapStyle.
[since Esri::ArcGISRuntime 100.10]
Basemap::Basemap(Esri::ArcGISRuntime::BasemapStyle basemapStyle , Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)
Construct a Basemap with a style and a credential.
- basemapStyle - The basemap style.
- credential - the credential to use.
- parent - The optional parent QObject.
This function was introduced in Esri::ArcGISRuntime 100.10.
Basemap::Basemap(const QList<Esri::ArcGISRuntime::Layer *> &baseLayers , const QList<Esri::ArcGISRuntime::Layer *> &referenceLayers , QObject *parent = nullptr)
Construct a Basemap from baseLayers and referenceLayers with an optional parent.
[since Esri::ArcGISRuntime 200.3]
Basemap::Basemap(Esri::ArcGISRuntime::BasemapStyle basemapStyle , Esri::ArcGISRuntime::BasemapStyleParameters *basemapStyleParameters , QObject *parent = nullptr)
Creates a basemap from an initial BasemapStyle with additional parameters to control settings like language.
- basemapStyle - The initial basemap style.
- basemapStyleParameters - Parameters that control how the BasemapStyle is used - for example by adjusting the language used for basemap labels.
- parent - The optional parent QObject.
These basemaps are secured and access requires either an API key or an authenticated user.
The initial state of the Basemap is LoadStatus::NotLoaded. When the Basemap is loaded the values specified in the BasemapStyleParameters are evaluated. See BasemapStyleParameters for information about the expected behavior for each parameter when the Basemap is loaded.
This function was introduced in Esri::ArcGISRuntime 200.3.
See also BasemapStyle.
[override virtual]
Basemap::~Basemap()
Destructor.
[override virtual, since Esri::ArcGISRuntime 100.11]
QString Basemap::apiKey () const
Reimplements: ApiKeyResource::apiKey() const.
Returns the API key allows your app to access ArcGIS location services and private portal items.
An API key is a unique long-lived access token that is used to authenticate and monitor requests to ArcGIS location services and private portal items. You can create and manage an API key using your portal when you sign in with an ArcGIS Location Platform account or an ArcGIS Online account with administrator access or a custom role that has the `Generate API keys` privilege. To learn how to create and manage API keys, go to the Create an API Key tutorial. You must ensure that your API key has the correct privileges to access secure resources.
Note: An API key created with a referrer is not supported. If you need service requests to include the referrer, use the SDK's functionality to intercept the request and add an HTTP referer header.
In addition to setting an ArcGISRuntimeEnvironment::apiKey at a global level for your application, you can set it on any class that implements ApiKeyResource. This overrides the ArcGISRuntimeEnvironment::apiKey and enables more granular usage telemetry and management of ArcGIS location resources used by your app.
Classes that expose an API key property by implementing ApiKeyResource include:
- ArcGISSceneLayer
- ArcGISTiledLayer
- ArcGISVectorTiledLayer
- Basemap
- BasemapStylesService
- ClosestFacilityTask
- ExportTileCacheTask
- ExportVectorTilesTask
- GeodatabaseSyncTask
- LocatorTask
- RouteTask
- ServiceAreaTask
- ServiceFeatureTable
For more information, see API key authentication and Types of authentication.
This function was introduced in Esri::ArcGISRuntime 100.11.
See also setApiKey().
Esri::ArcGISRuntime::LayerListModel *Basemap::baseLayers () const
Returns the collection of base layers in this basemap.
Base layers are drawn beneath all other layers in the Map or Scene. They are designed to provide a visual reference to help orient the user. Aerial imagery, terrain, and streets are examples of basemap layers. The collection can be empty but it is never nullptr
.
This collection is specific to this basemap so you cannot reuse a collection coming from another Basemap.
See also Layer and GeoModel::operationalLayers.
[override virtual]
void Basemap::cancelLoad ()
Reimplements: Loadable::cancelLoad().
See Loadable.
[since Esri::ArcGISRuntime 200.1]
Esri::ArcGISRuntime::Basemap *Basemap::clone(QObject *parent = nullptr) const
Clones the basemap to a new instance with an optional parent.
Returns a new instance of the current basemap.
All objects referenced by the basemap, such as layers or portal item, are copied as well.
This function was introduced in Esri::ArcGISRuntime 200.1.
[override virtual]
Esri::ArcGISRuntime::Credential *Basemap::credential() const
Reimplements: RemoteResource::credential() const.
Returns the security credential used to access the basemap.
[signal]
void Basemap::doneLoading (const Esri::ArcGISRuntime::Error &loadError )
Signal emitted when Basemap is done loading.
- loadError - Details about any error that may have occurred.
Note: If there is a load error it will also be emitted on the errorOccurred
signal.
[static]
Esri::ArcGISRuntime::Basemap *Basemap::fromJson (const QString &json, QObject *parent = nullptr)
Creates a new Basemap from json with an optional parent.
See also JsonSerializable.
Esri::ArcGISRuntime::Item *Basemap::item() const
Returns the portal item associated with this basemap.
See also Basemap.
[override virtual]
void Basemap::load()
Reimplements: Loadable::load().
See Loadable.
[override virtual]
Esri::ArcGISRuntime::Error Basemap::loadError () const
Reimplements: Loadable::loadError() const.
See Loadable.
[override virtual]
Esri::ArcGISRuntime::LoadStatus Basemap::loadStatus () const
Reimplements: Loadable::loadStatus() const.
See Loadable.
[signal]
void Basemap::loadStatusChanged (Esri::ArcGISRuntime::LoadStatus loadStatus )
loadStatus See Loadable.
QString Basemap::name() const
Returns the name of this basemap.
See also setName().
Esri::ArcGISRuntime::LayerListModel *Basemap::referenceLayers () const
Returns the collection of reference layers in this basemap.
Reference layers are drawn on top all other layers in the Map or Scene to display information such as boundaries, labels, and traffic networks. The collection can be empty but it is never nullptr
.
This collection is specific to this basemap so you cannot reuse a collection coming from another Basemap.
See also Layer, GeoModel::operationalLayers, and baseLayers.
[override virtual, since Esri::ArcGISRuntime 100.10]
Esri::ArcGISRuntime::RequestConfiguration Basemap::requestConfiguration () const
Reimplements: RemoteResource::requestConfiguration() const.
Returns the RequestConfiguration in use by this basemap.
This function was introduced in Esri::ArcGISRuntime 100.10.
See also setRequestConfiguration().
[override virtual]
void Basemap::retryLoad ()
Reimplements: Loadable::retryLoad().
See Loadable.
[override virtual, since Esri::ArcGISRuntime 100.11]
void Basemap::setApiKey (const QString &apiKey )
Reimplements: ApiKeyResource::setApiKey(const QString &apiKey).
Sets the API key to apiKey.
This function was introduced in Esri::ArcGISRuntime 100.11.
See also apiKey().
void Basemap::setName (const QString &name)
Sets the name of the Basemap.
- name - The new Basemap name.
See also name().
[override virtual, since Esri::ArcGISRuntime 100.10]
void Basemap::setRequestConfiguration (const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration )
Reimplements: RemoteResource::setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration).
Sets configuration parameters used for network requests sent by this basemap to requestConfiguration.
This function was introduced in Esri::ArcGISRuntime 100.10.
See also requestConfiguration().
[override virtual]
QString Basemap::toJson () const
Reimplements: JsonSerializable::toJson() const.
Gets the json representation of this object.
See also JsonSerializable.
[override virtual]
QJsonObject Basemap::unknownJson () const
Reimplements: JsonSerializable::unknownJson() const.
Gets the unknown JSON of this object.
See also JsonSerializable.
[override virtual]
QJsonObject Basemap::unsupportedJson () const
Reimplements: JsonSerializable::unsupportedJson() const.
Gets the unsupported JSON of this object.
See also JsonSerializable.
[override virtual]
QUrl Basemap::url() const
Reimplements: RemoteResource::url() const.
Gets the URL of the Basemap.
Returns the URL.