Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey, Delphi Android, Delphi IOS

TeeChart Mapping Data Demo Source Code In Delphi XE6 Firemonkey On Windows And OSX

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Delphi XE6 Firemonkey TeeChart Maps Android IOS | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSDeveloper David Berneda from Steema Software has a demo up on using GIS map information in TeeChart cross platform in Delphi XE6 Firemonkey. TeeChart is a charting component for Firemonkey that runs on Andoid, IOS, Windows, and OSX. The component can use ESRI SHP files, KML paths, and Placemark text files for loading map data. This specific demo contains a Firemonkey desktop demo application with source code and map data of the United States. We;ve covered the component itself in a previous post about TeeChart for Firemonkey. TeeChart is a commercial component so you’ll need to own a license for it to be able to compile the demo. The component and demo probably also work in AppMethod.Here is a sample function from the demo which demonstrates various ways to load map data into the component:
procedure TMainForm.FormCreate(Sender: TObject);
var s : TStringList;
begin
// NOTE:
// Most of the following code its not necessary at all.
// Same features can also be done at design-time using the
// TeeChart editor dialog or Object Inspector.
// Do not show Legend, Axes and Walls:

Chart1.Legend.Hide;
Chart1.Axes.Hide;
Chart1.Walls.Hide;

// Cosmetics:

Chart1.Color:=clWhite;
Chart1.View3D:=False;
Chart1.Title.Caption:='USA';

// Match USA map aspect when zooming:
Chart1.Zoom.KeepAspectRatio:=True;

// Create USA map:

USA:=TWorldSeries.Create(Self);
USA.Map:=wmUSA;

USA.Color:=clWhite;

USA.ParentChart:=Chart1;

USA.FillSampleValues;

// Add tools:

Chart1.Tools.Add(TMarksTipTool);

// Import Route 66 KML

Route66:=TLineSeries.Create(Self);
TTeeKMLSource.Load(Route66,'Data\Route66.kml');

Chart1.AddSeries(Route66);

// Cosmetics:

Route66.Pointer.Visible:=True;
Route66.Pointer.Size:=3;
Route66.Pointer.Style:=psCircle;
Route66.Pointer.Pen.Color:=TTeeCanvas.ColorFrom(TAlphaColors.Red,128);
Route66.Pointer.Color:=TAlphaColors.MoneyGreen;

// Nuclear Plants

NuclearPlants:=TPointSeries.Create(Self);
NuclearPlants.Pointer.Size:=2;

TTeeKMLSource.Load(NuclearPlants,'Data\WorldPowerPlants.kml');

Chart1.AddSeries(NuclearPlants);

HidePointsOutsideUSA(NuclearPlants);

// USA Cities

Cities:=TPointSeries.Create(Self);

// Load txt file and add to Cities series:
s:=TStringList.Create;
try
s.LoadFromFile('Data\USACities.txt');
USA.AddPlacemarks(s,Cities);
finally
s.Free;
end;

Cities.Pointer.Size:=2;
Cities.Pointer.Pen.Hide;

Cities.ParentChart:=Chart1; // <-- same as: Chart1.AddSeries(Cities)

// Hide cities in Alaska, etc:
HidePointsOutsideUSA(Cities);

// Populated areas ESRI ShapeFile:

Populated:=TMapSeries.Create(Self);
Populated.ParentChart:=Chart1;

LoadMap(Populated,'Data\ne_50m_urban_areas.shp');

// Change automatic colors of Population area polygons:
Populated.PaletteStyle:=psRainbow;
Populated.UseColorRange:=False;
Populated.UsePalette:=True;

HidePointsOutsideUSA(Populated);
end;
Head over and check out the full blog post about loading GIS map data in TeeChart and then download the Firemonkey demo.

 

Exit mobile version