A map in a few lines.
OpenStreetMap tiles, three markers, a geodesic line and a radius, fitted to the markers and saved as PNG. The same API in Delphi, C++ Builder and C#.
dotnet add package esegece.sgcMaps.Rendering
C++ Builder and C# versions
uses
SysUtils, Controls, Graphics, sgcMaps_Classes, sgcMaps_Providers,
sgcMaps_Geometry, sgcMaps_VCL;
// OpenStreetMap with cached tiles, three capitals, a geodesic flight line
// and a 300 km radius, fitted to the markers and saved as PNG.
procedure BuildMap(aOwner: TWinControl);
var
oMap: TsgcVCLMap;
oLayer: TsgcMapLayer;
oLine: TsgcMapPolyline;
begin
oMap := TsgcVCLMap.Create(aOwner);
oMap.Parent := aOwner;
oMap.Align := alClient;
oLayer := oMap.Layers.Add;
oLayer.Name := 'OpenStreetMap';
oLayer.Provider := mtpOpenStreetMap;
sgcMapApplyProvider(oLayer);
oLayer.CacheFolder := ExtractFilePath(ParamStr(0)) + 'tile_cache';
oMap.AddMarker(48.8566, 2.3522, 'Paris', 'France');
oMap.AddMarker(52.5200, 13.4050, 'Berlin', 'Germany');
oMap.AddMarker(41.9028, 12.4964, 'Rome', 'Italy');
oMap.MarkerOptions.Clustering.Enabled := True;
oLine := oMap.AddPolyline;
oLine.Geodesic := True;
oLine.Dashed := True;
oLine.Color := clRed;
oLine.AddPoint(48.8566, 2.3522);
oLine.AddPoint(52.5200, 13.4050);
oMap.AddCircle(48.8566, 2.3522, 300000).FillOpacity := 0.15;
oMap.FitToMarkers(40);
oMap.AddLabel(50.7, 8, Format('Paris to Berlin: %.0f km',
[sgcMapDistance(48.8566, 2.3522, 52.52, 13.405) / 1000]));
oMap.SaveToPNG('europe.png', 1200, 800);
end;