TMS FNC MapKit — Guides
Markers
Add markers via Markers.Add and set Coordinate.Latitude, Coordinate.Longitude, and Title.
Polygons
Use Polygons.Add (TTMSFNCMapKitPolygon) to add area overlays. Populate the Coordinates collection and set fill and stroke properties.
Map type
Choose between standard, satellite, and hybrid map types via Options.MapType.
Labels and complex polygons
Use the Labels collection to place standalone text callouts on the map independently of markers — useful for naming a region, a zone, or a point of interest without the marker pin visuals. Each TTMSFNCMapsLabel exposes Coordinate, Text, BackgroundColor, BorderColor, and Font so a label can be styled to match the rest of the map.
Polygons support complex shapes with inner holes through TTMSFNCMapKitPolygon.AddHole. Build the outer ring with AddPolygon, then call AddHole on the returned polygon with the coordinates of the inner ring to cut it out of the filled area — for example to represent a courtyard, a lake inside a park boundary, or an excluded zone inside a coverage area.
procedure TForm1.ConfigureMapKitLabelsAndPolygon;
var
LLabel: TTMSFNCMapsLabel;
LOuter, LInner: TTMSFNCMapsCoordinateRecArray;
LPolygon: TTMSFNCMapKitPolygon;
begin
{ Add a text label at a coordinate }
LLabel := TMSFNCMapKit1.Labels.Add;
LLabel.Coordinate.Latitude := 37.7749;
LLabel.Coordinate.Longitude := -122.4194;
LLabel.Text := 'San Francisco HQ';
LLabel.BackgroundColor := gcWhite;
LLabel.BorderColor := gcDodgerblue;
{ Outer ring of the polygon }
SetLength(LOuter, 4);
LOuter[0].Latitude := 37.782;
LOuter[0].Longitude := -122.447;
LOuter[1].Latitude := 37.782;
LOuter[1].Longitude := -122.425;
LOuter[2].Latitude := 37.768;
LOuter[2].Longitude := -122.425;
LOuter[3].Latitude := 37.768;
LOuter[3].Longitude := -122.447;
{ Inner ring cut out as a hole }
SetLength(LInner, 4);
LInner[0].Latitude := 37.778;
LInner[0].Longitude := -122.441;
LInner[1].Latitude := 37.778;
LInner[1].Longitude := -122.431;
LInner[2].Latitude := 37.772;
LInner[2].Longitude := -122.431;
LInner[3].Latitude := 37.772;
LInner[3].Longitude := -122.441;
LPolygon := TMSFNCMapKit1.AddPolygon(LOuter, True);
LPolygon.FillColor := gcDodgerblue;
LPolygon.FillOpacity := 0.35;
LPolygon.StrokeColor := gcNavy;
LPolygon.AddHole(LInner);
end;
Directions
Use AddDirections to request and render a route between two points on the map. Overloads accept textual addresses, TTMSFNCMapsCoordinateRec values, or raw latitude/longitude pairs, and let you control whether endpoint markers and the route polyline are shown, plus the polyline color, width, opacity, and travel mode (dtmDriving or dtmWalking). Handle OnRetrievedDirectionsData to read the parsed TTMSFNCMapKitDirectionsData once the directions service responds — each route carries its distance, travel time, and an ordered list of instruction steps. Call ClearDirections to remove all directions items from the map.
procedure TForm1.FormCreate(Sender: TObject);
begin
TMSFNCMapKit1.OnRetrievedDirectionsData := TMSFNCMapKit1DirectionsDataRetrieved;
end;
procedure TForm1.AddMapKitDirections;
begin
{ Route between two textual addresses, driving directions with markers and polyline }
TMSFNCMapKit1.AddDirections('San Francisco, CA', 'Oakland, CA',
True, True, gcBlue, 3, 1, dtmDriving);
end;
procedure TForm1.TMSFNCMapKit1DirectionsDataRetrieved(Sender: TObject;
AEventData: TTMSFNCMapsEventData; ADirectionsData: TTMSFNCMapKitDirectionsData);
var
I: Integer;
begin
if Length(ADirectionsData.Routes) > 0 then
begin
for I := 0 to Length(ADirectionsData.Routes[0].Steps) - 1 do
Memo1.Lines.Add(ADirectionsData.Routes[0].Steps[I].Instructions);
end;
end;
procedure TForm1.ClearMapKitDirections;
begin
TMSFNCMapKit1.ClearDirections;
end;
Map rotation
Options.MapRotation rotates the map view by the specified number of degrees, which is useful for aligning the map with a heading or a fixed reference direction instead of always facing north. Handle OnMapRotationChanged to react whenever the user rotates the map interactively, for example to keep a compass indicator or a heading label in sync with the current view.
procedure TForm1.FormCreate(Sender: TObject);
begin
TMSFNCMapKit1.OnMapRotationChanged := TMSFNCMapKit1MapRotationChanged;
{ Rotate the map 45 degrees clockwise from north }
TMSFNCMapKit1.Options.MapRotation := 45;
end;
procedure TForm1.TMSFNCMapKit1MapRotationChanged(Sender: TObject;
AEventData: TTMSFNCMapsEventData);
begin
Memo1.Lines.Add('Map rotation changed');
end;
Platform note
MapKit is only available when targeting macOS or iOS. On other platforms, use a different map component such as TTMSFNCGoogleMaps or TTMSFNCLeaflet.