Back to Devexpress

TdxMapControlAzureMapImageryDataProvider.AzureKey Property

vcl-dxazuremapimagerydataprovider-dot-tdxmapcontrolazuremapimagerydataprovider.md

latest4.6 KB
Original Source

TdxMapControlAzureMapImageryDataProvider.AzureKey Property

Specifies the Azure account key for the map tile provider.

Declaration

delphi
property AzureKey: string read; write;

Property Value

TypeDescription
string

The Azure account key for the map tile provider.

|

Remarks

To use Microsoft Azure Maps® services, you need to create an Azure Maps account and obtain a key.

Refer to the following Microsoft documentation topics for additional information:

Assign Azure Key

Assign your Azure account key to the AzureKey property to configure the map tile provider. The current map layer starts to download tile data automatically according to the current provider settings. Refer to the TdxMapControlAzureMapImageryDataProvider class description for information on all available data provider settings.

Important

You need to assign your Azure account key to the AzureKey property of all Azure Maps tile and information providers you use in the application.

Code Example: Add a Tile Map Layer and Load Azure Maps Data

The following code example implements a procedure that accepts an Azure Maps account key, creates and configures a map tile layer, and loads data:

delphi
uses
  dxAzureMapImageryDataProvider; // Declares TdxMapControlAzureMapImageryDataProvider
// ...

procedure TMyForm.AddAzureMapLayer(const AAzureKey: string);
var
  ATileLayer: TdxMapImageTileLayer;
  AProvider: TdxMapControlAzureMapImageryDataProvider;
begin
  ATileLayer := dxMapControl1.Layers.Add(TdxMapImageTileLayer) as TdxMapImageTileLayer;
  ATileLayer.ProviderClass := TdxMapControlAzureMapImageryDataProvider;
  AProvider := ATileLayer.Provider as TdxMapControlAzureMapImageryDataProvider;
  AProvider.BeginUpdate; // Initiates the following batch change
  try
    AProvider.AzureKey := AAzureKey; // Assigns the Azure account key
    AProvider.Tileset := TdxAzureMapTileset.Satellite; // Changes the default tileset
    AProvider.MaxParallelConnectionCount := 8; // Explicitly defines the number of parallel connections
  finally
    AProvider.EndUpdate; // Calls EndUpdate regardless of the batch operation's success
  end;
end;
cpp
#include "dxAzureMapImageryDataProvider.hpp" // Declares TdxMapControlAzureMapImageryDataProvider
// ...

void __fastcall TMyForm::AddAzureMapLayer(const UnicodeString &AAzureKey)
{
  TdxMapLayer *ALayer;
  TdxMapImageTileLayer *ATileLayer;
  TdxMapControlAzureMapImageryDataProvider *AProvider;

  ALayer = dxMapControl1->Layers->Add(__classid(TdxMapImageTileLayer));
  ATileLayer = dynamic_cast<TdxMapImageTileLayer*>(ALayer);
  ATileLayer->ProviderClass = __classid(TdxMapControlAzureMapImageryDataProvider);
  AProvider = dynamic_cast<TdxMapControlAzureMapImageryDataProvider*>(ATileLayer->Provider);
  AProvider->BeginUpdate(); // Initiates the following batch change
  try
  {
    AProvider->AzureKey = AAzureKey; // Assigns the Azure account key
    AProvider->Tileset = TdxAzureMapTileset::Satellite; // Changes the default tileset
    AProvider->MaxParallelConnectionCount = 8; // Explicitly defines the number of parallel connections
  }
  __finally
  {
    AProvider->EndUpdate(); // Calls EndUpdate regardless of the batch operation's success
  }
}

See Also

TdxMapControlAzureMapInformationProvider.AzureKey Property

TdxMapControlAzureMapImageryDataProvider Class

TdxMapControlAzureMapImageryDataProvider Members

dxAzureMapImageryDataProvider Unit