Back to Devexpress

TdxMapControlAzureMapImageryDataProvider Class

vcl-dxazuremapimagerydataprovider.md

latest9.7 KB
Original Source

TdxMapControlAzureMapImageryDataProvider Class

An Azure Maps tile data provider.

Declaration

delphi
TdxMapControlAzureMapImageryDataProvider = class(
    TdxMapControlImageTileProvider
)

Remarks

An Azure Maps tile data provider is the main component required to display Microsoft Azure Maps® in the Map Control. You need to configure the data provider for each tile map layer in your application.

Azure Maps Account

To use Microsoft Azure Maps® services, you need to create an Azure Maps account and obtain a key. Assign the account key to the AzureKey property to configure the data provider.

Main API Members

The list below outlines key members of the TdxMapControlAzureMapImageryDataProvider class. These members allow you to configure the Azure Maps tile provider.

Server-Related Settings

AzureKey Required. Specifies the account key required to use the Azure Maps tile provider.CacheOptionsProvides access to tile data cache settings.LanguageOptional. Specifies the required language.LocalizedMapViewOptional. Specifies the target region. This property allows you to download region-specific map tile information.MaxParallelConnectionCountLimits the number of parallel connections to Azure Maps servers.TilesetSpecifies the required tileset.UTCTimeStampAllows you to display time-specific map information if a weather data tileset is active.

General-Purpose API Members

AssignCopies settings between Azure Maps tile providers.BeginUpdate | EndUpdateAllow you to avoid excessive server requests and notifications during batch setting changes in the map tile provider.

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
  }
}

Microsoft Azure Map Information Providers

Map information providers complement the tile data provider and allow you to display additional map-related information, such as routes. The Map Control ships with the following Azure Maps information providers:

TdxMapControlAzureMapGeocodeProviderAn Azure Maps Geocode information provider.TdxMapControlAzureMapGeolocationProviderAn Azure Maps Geolocation information provider.TdxMapControlAzureMapReverseGeocodeProviderAn Azure Maps Reverse Geocode information provider.TdxMapControlAzureMapRouteProviderAn Azure Maps Route information provider.

Important

You need to assign the same Azure Maps account to the AzureKey property of each map information provider in the application.

Indirect TdxMapControlAzureMapImageryDataProvider Class Reference

The TdxMapImageTileLayer.Provider property references the TdxMapControlAzureMapImageryDataProvider class as a TdxMapControlImageTileProvider object if the ProviderClass property is set to TdxMapControlAzureMapImageryDataProvider.

You need to cast the returned object to the TdxMapControlAzureMapImageryDataProvider class to access all public API members.

Direct TdxMapControlAzureMapImageryDataProvider Class Reference

The TdxMapControlImageTileProviderClass type references the TdxMapControlAzureMapImageryDataProvider class.

To see Microsoft Azure Map tile and information providers in action, run the Mapping demo in the VCL Demo Center installed with compiled DevExpress demos. When the demo is opened, it downloads tile data and additional information from Azure Map servers to display a map and build routes between specified points.

Download: Compiled VCL Demos

Tip

Compiled DevExpress demos ship with source code installed in the Public Documents folder (%Public%) for all users ( default ). You can find all project and source code files for the Map Control demo in the following folder:

%Public%\Documents\DevExpress VCL Demos\MegaDemos\Product Demos\ExpressMapControl

Inheritance

TObject TPersistent TcxOwnedPersistent TdxMapControlImageTileProvider TdxMapControlAzureMapImageryDataProvider

See Also

TdxMapControlOpenStreetMapImageryDataProvider Class

TdxMapControlAzureMapImageryDataProvider Members

dxAzureMapImageryDataProvider Unit