Skip To Content ArcGIS for Developers Sign In Dashboard

ImageTiledLayer Class

(Esri::ArcGISRuntime::ImageTiledLayer)

A base class for layers that display tiled map services and cached image services. More...

Header: #include <ImageTiledLayer>
Since: Esri::ArcGISRuntime 100.0
Inherits: ImageAdjustmentLayer
Inherited By:

Esri::ArcGISRuntime::ArcGISTiledLayer, Esri::ArcGISRuntime::ServiceImageTiledLayer, and Esri::ArcGISRuntime::WmtsLayer

Public Functions

ImageTiledLayer(const TileInfo &tileInfo, const Envelope &fullExtent, QObject *parent = nullptr)
~ImageTiledLayer()
NoDataTileBehavior noDataTileBehavior() const
virtual void setAttribution(const QString &attribution)
void setNoDataTileBehavior(NoDataTileBehavior noDataTileBehavior)
TileInfo tileInfo() const

Signals

void cancelTileRequest(const Esri::ArcGISRuntime::TileKey &tileKey)
void tileRequest(const Esri::ArcGISRuntime::TileKey &tileKey)

Protected Functions

void setNoDataTile(const TileKey &tileKey)
void setTileData(const TileKey &tileKey, const QByteArray &data)
void setTileError(const TileKey &tileKey, const QString &error)
  • 9 protected functions inherited from QObject

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 layers that display tiled map services and cached image services.

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

Creating a custom image tiled layer

To implement your own custom ImageTiledLayer, for example to load your own local tile data, you should derive from this type and supply the data for each tile as it is requested.

This allows you to asynchronously generate a byte array (for example from an image file on the device) for each tile.

To do this, connect to the tileRequest signal and call one of the the following protected methods for each TileKey which is requested:

FunctionDescription
setTileDataSets the byte array corresponding to a tile request.
setTileErrorSets the error corresponding to a tile request.
setNoDataTileIf there is no data corresponding to a tile request.

The tileInfo parameter defines the format of images (image format, DPI, width and height), and the limits of extent and scale factor for requests.

CustomTiledLayer::CustomTiledLayer(const TileInfo& tileInfo, const Envelope& fullExtent, QObject* parent) :
  ImageTiledLayer(tileInfo, fullExtent, parent)
{
  connect(this, &CustomTiledLayer::tileRequest, this, [this](const TileKey& tileKey)
  {
    QString localUrl = tilesDataRoot() + QString("/tiledata/%1-%2-%3.jpg").arg(
          QString::number(tileKey.level()),
          QString::number(tileKey.row()),
          QString::number(tileKey.column()));

    QFile f(localUrl);
    if (!f.exists())
    {
      sendMessage(QString("Cannot find: %1").arg(localUrl));
      setNoDataTile(tileKey);
    }
    else if (!f.open(QIODevice::OpenModeFlag::ReadOnly))
    {
      sendMessage(QString("Cannot open: %1").arg(localUrl));
      setTileError(tileKey, QString("Cannot open: %1").arg(localUrl));
    }
    else
      setTileData(tileKey, f.readAll());
  });
}

You can also connect to the cancelTileRequest signal in order to terminate tile requests which are no longer required.

See also TileInfo.

Member Function Documentation

ImageTiledLayer::ImageTiledLayer(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.

ImageTiledLayer::~ImageTiledLayer()

Destructor.

[signal] void ImageTiledLayer::cancelTileRequest(const Esri::ArcGISRuntime::TileKey &tileKey)

NoDataTileBehavior ImageTiledLayer::noDataTileBehavior() const

Gets the NoDataTileBehavior for the layer.

Determines how a tile request that returns 'NoData' is resampled.

Zooming in can result in tile requests with no tiles at the requested level of detail. In this case, there are options that control what to display where the tile should be.

ValueDescription
NoDataTileBehavior::UpSample (0)Upsample the pixels from a lower level of detail tile. This can result in pixelation or blurriness. This is the default behavior for operational layers.
NoDataTileBehavior::Blank (1)The 'NoData' pixels will show the raster picture as being blank (or disappearing). This is the default behavior for basemap reference layers.
NoDataTileBehavior::Show (2)This will show the raster picture with the text 'No Data' stamped over it once you pass the lowest level-of-detail scale.

Note: Sometimes, to see the effect on the map when setting the NoDataTileBehavior property, the Layer::maxScale value must also be explicitly set. The Layer::maxScale property may need to be smaller than the level-of-detail setting that was used to create the tiled images in ArcGIS Pro or ArcGIS Desktop. For example, consider an operational image tile layer showing forest cover that was created with the level-of-detail assumption that it was to be viewed above a scale of 5000 (meaning you will not see 'NoData' until you zoom closer to the Earth than a 5000 scale). However, you want to be able to zoom in closer to the Earth surface, say down to 3000 or 300. By setting the Layer::maxScale property to a number smaller than 5000, you will be able to zoom in closer to the Earth and see the effects of changing the `NoDataTileBehavior` enumerations.

See also setNoDataTileBehavior().

[virtual] void ImageTiledLayer::setAttribution(const QString &attribution)

Sets the attribution text to attribution.

This function was introduced in Esri::ArcGISRuntime 100.1.

[protected] void ImageTiledLayer::setNoDataTile(const TileKey &tileKey)

Specifies that there is no data corresponding to a tileKey.

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

This function was introduced in Esri::ArcGISRuntime 100.2.

void ImageTiledLayer::setNoDataTileBehavior(NoDataTileBehavior noDataTileBehavior)

Sets the NoDataTileBehavior for the layer to noDataTileBehavior.

This determines how NoData tiles are handled and displayed.

See also noDataTileBehavior().

[protected] void ImageTiledLayer::setTileData(const TileKey &tileKey, const QByteArray &data)

Sets data corresponding to a tileKey.

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

This function was introduced in Esri::ArcGISRuntime 100.2.

[protected] void ImageTiledLayer::setTileError(const TileKey &tileKey, const QString &error)

Sets an error corresponding to a tileKey.

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

This function was introduced in Esri::ArcGISRuntime 100.2.

TileInfo ImageTiledLayer::tileInfo() const

Returns the TileInfo.

[signal] void ImageTiledLayer::tileRequest(const Esri::ArcGISRuntime::TileKey &tileKey)


Feedback on this topic?