Composant Delphi / Google Maps / OpenStreetMap / Leaflet  / Mappilary / Native Maps 100% Delphi 0% WebBrowser 0% Javascript


you are here :TECMap > Overlays

Pois (point of interest) are equivalent to the markers, the difference is that they are supported natively by Delphi, they are so light and fast, you can incorporate several thousands without worries.

You have 4 predefined shapes (Ellipse, rectangle, triangle and star) but you can also take in charge their design.

Fig. 48 DemoPOI

Does not work on Chromium !


POIs are managed by an TECMapPois list accessible through the Pois TECMap property


This list has the following methods and properties :

function Add(const dLatitude,dLongitude:double):integer;

Adds a POI to the point Latitude, Longitude and returns its index in the list.

// Delphi map component ECMap

// add POI at center of map
id := map.Pois.add(map.latitude,map.longitude);
// set caption to this POI
map.Pois[id].caption := 'my first POI!';

function ByLatLng(const dLatitude,dLongitude:double):TECMapPoi;

Returns the POI positioned at Latitude, Longitude

procedure Clear;

Clears all POIs

procedure Delete(index:integer);

Removes the POI which you pass the index

property Count:integer;

Returns the number of POI in the list

procedure fitBounds

Adjusts the zoom of the map to display the set of POIs

property Poi[index:integer]:TECMapPOI;

Table allowing access to POIs, it is the default property so you can access it directly by map.Pois[index] Instead of map.Pois.Poi[index]
property ToKml : string;
Property read-only that returns a string in the Kml format containing the list of POIs
property ToTxt : string;
Property read/write which gives access to the list of POIs in a text format.

In writing it is an addition, not a replacement, If you do not want to keep the old values made a Clear before adding


property ShowHint : boolean

Indicates whether to display the caption of a POI in a bubble when hovering the mouse over

property OnOwnerDrawPOI : TOnOwnerDrawPOI

Specify a procedure to support the design of type POI poiOwnerDraw

// Delphi map component ECMap

map.Pois.OnOwnerDraw := doOwnerDrawPOI;

// owner draw poi, here transparancy text
procedure TFormPoi.doOwnerDrawPOI(const canvas:TCanvas;var Rect:TRect;item:TECMapPoi) ;

canvas.brush.Style := bsClear;

if item.Hover then
canvas.font.color := item.HoverColor
canvas.font.color := item.color;

canvas.font.Style := [fsBold];

item.Width := canvas.TextWidth(item.caption) ;
item.height := canvas.TextHeight(item.caption) ;

item.x := item.x - (item.Width div 2);
item.y := item.y - (item.height div 2);



property DragPoi : TECMapPoi

If a POI is moved with the mouse this the reference property


This class manages a POI, it has the following methods and properties :

procedure setPosition(const dLatitude,dLongitude:double);
Move the POI in Latitude, Longitude, raises the OnOverlayMove event
procedure PanTo;
Moves the map so that its centre coincides with the POI, raises the OnMapMove event

property Caption: string

property Color: TColor

Color of the POI

property HoverColor: TColor

The mouse-over color

property Latitude: double

Read-only property, use SetPosition

property Longitude: double

Read-only property, use SetPosition

property X : integer

Position horizontal pixel, calculated automatically depending on the latitude

property Y : integer

Vertical position in pixels, calculated automatically depending on the longitude

property Width : integer

Width in pixels

property height : integer

Height in pixels

property Draggable : boolean

Indicates if the POI is draggable mouse

property Shape : TPOIShape

poiEllipse, poiRectangle, poiTriangle, poiStar et poiOwnerDraw

property Hover : boolean

Indicates if the POI is overflown by the mouse

property OnBeforeDrawPOI : TOnOwnerDrawPOI

Specify a procedure to draw on top of type POI poiEllipse, poiRectangle, poiTriangle et poiStar

Example, written his number on a POI

// Delphi map component ECMap

i := map.pois.add(map.Latitude,map.Longitude);

map.pois[i].Shape := poiStar;
map.pois[i].width := 25;
map.pois[i].height := 25;

map.pois[i].OnBeforeDrawPOI := doNumDrawPOI;

// draw poi id
procedure TFormDemoECMap.doNumDrawPOI(const canvas:TCanvas;var r:TRect;item:TECMapPoi) ;
var x,y,w,h : integer;
s : string;
begin := [fsBold];

s := inttostr(;

w := canvas.TextWidth(s) ;
h := canvas.TextHeight(s) ;

x := 1+((r.Left + r.Right) - w) DIV 2 ;
y := 1+((r.Top + r.Bottom) - h) DIV 2 ;

canvas.brush.Style := bsClear;

canvas.font.color := clWhite;



Pois meet the same events as overlays (OnOverlayXXX), their TOverlayType is ovPoi

go to page
© 2016 ESCOT-SEP Christophe - Made width Help&Web - RSS - Google+