TdxMapControlAzureMapGeocodeProvider.CreateQueryParams Method
In This Article
Creates an information container required to send a query to an Azure Maps server.
#Declaration
Delphi
function CreateQueryParams: IdxAzureMapGeocodeQueryParams;
#Returns
Type | Description |
---|---|
Idx |
Stores Azure Maps Geocode query parameters. |
#Remarks
Call the CreateQueryParams
function to create and configure geocode query parameters before an Execute or ExecuteAsync procedure call.
#Asynchronous Queries and Server Responses
To receive and process a response from an Azure Maps Geocode server after an ExecuteAsync procedure call, handle the OnResponse event.
#Code Example: Obtain Point Coordinates by Address
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;
See Also