vcl-dxazuremapinformationproviders-dot-tdxmapcontrolazuremapgeocodeprovider.md
Creates an information container required to send a query to an Azure Maps server.
function CreateQueryParams: IdxAzureMapGeocodeQueryParams;
| Type | Description |
|---|---|
| IdxAzureMapGeocodeQueryParams |
Stores Azure Maps Geocode query parameters.
|
Call the CreateQueryParams function to create and configure geocode query parameters before an Execute or ExecuteAsync procedure call.
To receive and process a response from an Azure Maps Geocode server after an ExecuteAsync procedure call, handle the OnResponse event.
The following code example implements a function that uses a configured information provider component to return the point on a map that corresponds to the specified address:
uses
dxAzureMapInformationProviders; // Declares TdxMapControlAzureMapGeocodeProvider
// ...
function TMyForm.GetAddressCoordinates(const AAddress: string): TdxMapControlGeoPoint;
var
AParams: IdxAzureMapGeocodeQueryParams;
AResponse: TdxAzureMapGeocodeRequestResponse;
AGeometry: TGeoJSONGeometry;
begin
AResult := nil;
AParams := dxMapControl1AzureMapGeocodeProvider1.CreateQueryParams;
AParams.Query := AAddress;
dxMapControl1AzureMapGeocodeProvider1.Execute(AParams, AResponse);
if AResponse <> nil then
begin
if AResponse.IsSuccess then
begin
AGeometry := AResponse.Features.First.Geometry;
AResult := TdxMapControlGeoPoint.Create(AGeometry.Coordinates[1], AGeometry.Coordinates[0]);
end;
end;
end;
#include "dxAzureMapInformationProviders.hpp" // Declares TdxMapControlAzureMapGeocodeProvider
// ...
TdxMapControlGeoPoint* __fastcall TMyForm::GetAddressCoordinates(const UnicodeString &AAddress)
{
_di_IdxAzureMapGeocodeQueryParams AParams;
TdxAzureMapGeocodeRequestResponse *AResponse;
TGeoJSONGeometry *AGeometry;
AParams = dxMapControl1AzureMapGeocodeProvider1->CreateQueryParams();
AParams->Query = AAddress;
dxMapControl1AzureMapGeocodeProvider1->Execute(AParams, AResponse);
if(AResponse != nullptr)
{
if(AResponse->IsSuccess)
{
AGeometry = AResponse->Features->First()->Geometry;
return new TdxMapControlGeoPoint(AGeometry->Coordinates[1], AGeometry->Coordinates[0]);
}
}
return nullptr;
}
See Also
TdxMapControlAzureMapReverseGeocodeProvider.CreateQueryParams Function
TdxMapControlAzureMapGeocodeProvider Class