Table of Contents

Getting started with TMS FNC Location

Prerequisites

  • TMS FNC Core installed and the runtime package added to the project.
  • TMS FNC Maps installed and the runtime package added to the project.
  • An API key for the location service backend (some services allow limited use without a key).

Add the component

  1. Drop TTMSFNCLocation from the TMS FNC Maps palette page onto a form.
  2. Set the APIKey property if required by your chosen service.
  3. Set the Service property to choose the location backend.

Look up an IP address

{ Inside a button click handler: }
var
  Req: TTMSFNCLocationRequest;
begin
  Req := TMSFNCLocation1.Requests.Add;
  Req.IPAddress := '8.8.8.8';
  TMSFNCLocation1.GetLocation;
end;

Handle the result

procedure TForm1.TMSFNCLocation1GetLocation(
  Sender: TObject; ARequestIndex: Integer;
  ARequest: TTMSFNCLocationRequest;
  ALocation: TTMSFNCLocationRequests);
begin
  { ALocation[0] contains Latitude, Longitude, City, Country }
end;

Next steps