property Markers[i]: TMarker
Description
Property to access existing markers on the map. Allows you to change/delete markers on the map.
Property |
Type |
Description |
Clickable |
Boolean |
When set to true, enables clicking on the marker. Clicking opens an extra info window on the Google Maps containing the text set by Marker.Title. |
Data |
String |
Store extra data associated with the marker. |
dbID |
Integer |
Allows to find out the marker id in the database (sense when more than 1 marker can be placed on the map). |
Draggable |
Boolean |
When set to true, the marker can be moved around the map when dragged. |
Icon |
String |
Allows the use of an image as a marker. A local path to an image file or an url to a remote image file are both allowed. The local path must be in the format: File://C:/folder/iconname.png |
IconColor |
TMarkerIconColor |
Allows changing the color of the default marker icon to one of the available pre-defined colors: icDefault, icBlue, icGreen, icRed and icPurple |
IconWidth |
Integer |
Specify a custom width value in pixels for the marker icon. Can only be used when the Icon property is assigned. If this value is not specified the icon is displayed in its full size. |
IconHeight |
Integer |
Specify a custom height value in pixels for the marker icon. Can only be used when the Icon property is assigned. If this value is not specified the icon is displayed in its full size. |
Index |
Integer |
Allows you to get the index of a marker on the map. |
Latitude |
Double |
Sets the latitude value of the marker on the map. |
Longitude |
Double |
Sets the longitude value of the marker on the map. |
Allows the use of a HTML label displayed on top of the marker. The label is automatically resized based on the Text value. More info. |
||
Tag |
Integer |
Allows you to assign a number to a component for your own needs. |
Text |
String |
The text that will be displayed over the marker. |
Title |
String |
Text that will be visible as a tooltip for the marker. |
Visible |
Boolean |
Determines the visibility of the marker on the map. |
Example
//display the coordinates of all markers on the map
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var
i, c: integer;
lat, lng: Double;
begin
c := Form1.Map1.Markers.Count-1;
for i := 0 to c do
begin
lat := Form1.Map1.Markers[i].Latitude;
lng := Form1.Map1.Markers[i].Longitude;
ShowMessage(Coordinates: ' + FloatToStr(lat)+', '+ FloatToStr(lng));
end;
end;