Skip To Content ArcGIS for Developers Sign In Dashboard

ServiceImageTiledLayer Class

(Esri::ArcGISRuntime::ServiceImageTiledLayer)

A base class for all image tiled layers that fetch map tiles from a remote service. More...

Header: #include <ServiceImageTiledLayer>
Since: Esri::ArcGISRuntime 100.1
Inherits: ImageTiledLayer and RemoteResource
Inherited By:

Esri::ArcGISRuntime::BingMapsLayer and Esri::ArcGISRuntime::WebTiledLayer

Public Functions

ServiceImageTiledLayer(const TileInfo &tileInfo, const Envelope &fullExtent, QObject *parent = nullptr)
ServiceImageTiledLayer(const TileInfo &tileInfo, const Envelope &fullExtent, Credential *credential, QObject *parent = nullptr)
~ServiceImageTiledLayer()

Reimplemented Public Functions

virtual Credential *credential() const
virtual RequestConfiguration requestConfiguration() const
virtual void setRequestConfiguration(const RequestConfiguration &requestConfiguration)
virtual QUrl url() const

Signals

void tileUrlRequest(const TileKey &tileKey)

Protected Functions

void setTileUrl(const TileKey &tileKey, const QUrl &url)

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 1 public variable inherited from QObject
  • 10 static public members inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

A base class for all image tiled layers that fetch map tiles from a remote service.

This is an abstract class that must be derived to implement your own service tile data scheme.

Creating a custom service image tiled layer

To implement your own custom ServiceImageTiledLayer, for example to load your own online tiles, you should derive from this type and supply the URL for each tile as it is requested.

To do this, connect to the tileUrlRequest signal and call the protected method setTileUrl for each TileKey which is requested:

The tile info parameter defines the format of images (image format, DPI, width and height) returned by remote service, and the limits of extent and scale factor for requests.

CustomServiceTiledLayer::CustomServiceTiledLayer(const TileInfo& tileInfo, const Envelope& fullExtent, QObject* parent) :
  ServiceImageTiledLayer(tileInfo, fullExtent, parent)
{
  connect(this, &CustomServiceTiledLayer::tileUrlRequest, this, [this](const TileKey& tileKey)
  {
    setTileUrl(tileKey, QUrl(QString("http://tile.openstreetmap.org/%1/%2/%3.png").arg(
                          QString::number(tileKey.level()),
                          QString::number(tileKey.column()),
                          QString::number(tileKey.row()))));
  });
}

Network requesting, downloading images and rendering are done internally.

Note: The URL supplied must be a valid online image URL. If the URL is not valid or if the image format doesn't match the tile info, ServiceImageTiledLayer will emit an error.

See also TileInfo.

Member Function Documentation

ServiceImageTiledLayer::ServiceImageTiledLayer(const TileInfo &tileInfo, const Envelope &fullExtent, QObject *parent = nullptr)

Constructor that accepts a tile info (tileInfo), an extent (fullExtent), and an optional parent.

This function was introduced in Esri::ArcGISRuntime 100.2.

ServiceImageTiledLayer::ServiceImageTiledLayer(const TileInfo &tileInfo, const Envelope &fullExtent, Credential *credential, QObject *parent = nullptr)

Constructor that accepts a tile info (tileInfo), an extent (fullExtent), a credential, and an optional parent.

This function was introduced in Esri::ArcGISRuntime 100.2.

ServiceImageTiledLayer::~ServiceImageTiledLayer()

Destructor.

[virtual] Credential *ServiceImageTiledLayer::credential() const

Reimplemented from RemoteResource::credential().

Returns the security credential used to access the layer. Only applicable if the service is secured.

[virtual] RequestConfiguration ServiceImageTiledLayer::requestConfiguration() const

Reimplemented from RemoteResource::requestConfiguration().

Returns the RequestConfiguration in use by this layer.

See also setRequestConfiguration().

[virtual] void ServiceImageTiledLayer::setRequestConfiguration(const RequestConfiguration &requestConfiguration)

Reimplemented from RemoteResource::setRequestConfiguration().

Sets requestConfiguration used for network requests sent by this layer.

See also requestConfiguration().

[protected] void ServiceImageTiledLayer::setTileUrl(const TileKey &tileKey, const QUrl &url)

Set the URL corresponding to the requested tileKey to url.

Note: This function should only be called when implementing your own custom service image tiled layer type.

This function was introduced in Esri::ArcGISRuntime 100.2.

[signal] void ServiceImageTiledLayer::tileUrlRequest(const TileKey &tileKey)

Signal emitted when a tile URL is requested.

  • tileKey - The key used to identify the specific tile.

Note: : React to this signal when implementing your own custom service image tiled layer type.

This function was introduced in Esri::ArcGISRuntime 100.2.

[virtual] QUrl ServiceImageTiledLayer::url() const

Reimplemented from RemoteResource::url().

Not implemented for ServiceImageTiledLayer.


Feedback on this topic?