Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TdxMapControlAzureMapReverseGeocodeProvider.ExecuteAsync(IdxAzureMapReverseGeocodeQueryParams) Method

Sends an asynchronous query to an Azure Maps server.

#Declaration

Delphi
procedure ExecuteAsync(const AParams: IdxAzureMapReverseGeocodeQueryParams);

#Parameters

Name Type Description
AParams IdxAzureMapReverseGeocodeQueryParams

Accepts a configured query parameters container.

Call the CreateQueryParams function to create a query parameters container.

#Remarks

Call the ExecuteAsync procedure to send an asynchronous query to an Azure Maps server.

#Receive Server Responses to Asynchronous Queries

Handle the OnResponse event to receive and process a server query after an ExecuteAsync procedure call.

#Code Example: Obtain Map Point Address Asynchronously

The code example in this section demonstrates a procedure that sends a query to an Azure Maps Reverse Geocode server and an OnResponse event handler that receives and processes the server response.

uses
  dxAzureMapInformationProviders, // Declares TdxMapControlAzureMapReverseGeocodeProvider
  dxMessageDialog;  // Declares the dxMessageDlg global function
// ...

procedure TMyForm.AddPushpin(AGeoPoint: TdxMapControlGeoPoint): Boolean;
var
  APushpin: TdxMapPushpin;
  AQueryParams: IdxAzureMapReverseGeocodeQueryParams;
begin
  // Creates a new pushpin on an existing map item layer
  APushpin := dxMapControl1ItemLayer1.MapItems.Add(TdxMapPushpin) as TdxMapPushpin;
  APushpin.Location.GeoPoint := AGeoPoint;
  AQueryParams := dxMapControl1AzureMapReverseGeocodeProvider1.CreateQueryParams;
  AQueryParams.Coordinates := APushpin.Location.GeoPoint;
  // Uses a configured reverse geocode provider to send a query to an Azure Maps server
  dxMapControl1AzureMapReverseGeocodeProvider1.ExecuteAsync(AQueryParams);
end;

procedure TMyForm.dxMapControl1AzureMapReverseGeocodeProvider1Response(
  ASender: TdxMapControlAzureMapReverseGeocodeProvider;
  AResponse: TdxAzureMapReverseGeocodeRequestResponse; var ADestroyResponse: Boolean);
var
  AMapItems: TdxMapItems;
  APushpin: TdxMapPushpin;
begin
  AMapItems := dxMapControl1ItemLayer1.MapItems;
  if AResponse <> nil then
  begin
    if AResponse.IsSuccess and (AResponse.Features.Count > 0) then // Checks if the query is successful
    begin
      APushpin := AMapItems.Items[AMapItems.Count - 1] as TdxMapPushpin;
      APushpin.Hint := AResponse.Features.First.Properties.Address.FormattedAddress;
    end
    else if Assigned(AResponse.ErrorInfo) then
      dxMessageDlg(AResponse.ErrorInfo.Message, TMsgDlgType.mtError, [mkOK], 0);
  end;
end;
See Also