Label near marker

Hello,


Is it possible to put a label to every marker, or a field with text?
Sincerely Peter

Hello,


I found  a sample below, but I would need a complete compileable example.

var Marker: TMarker;
begin
WebGMapsGeocoding1.Address := 'Paris, France';
if WebGMapsGeocoding1.LaunchGeocoding = erOk then begin Marker := WebGMaps1.Markers.Add; Marker.Latitude := WebGMapsGeocoding1.ResultLatitude;

Marker.Longitude := WebGMapsGeocoding1.ResultLongitude; Marker.Title := 'Destination: ' + WebGMapsGeocoding1.Address; Marker.MapLabel.Text := '<b>Destination:</b> ' + WebGMapsGeocoding1.Address; Marker.MapLabel.Color := clYellow; Marker.MapLabel.BorderColor := clRed; Marker.MapLabel.Font.Color := clRed; Marker.MapLabel.Font.Size := 14; Marker.MapLabel.Font.Name := 'Tahoma'; WebGMaps1.CreateMapMarker(Marker); end;

Sincerely Peter

Hello,


I am creating the markers in the following way:

Icon := LogRecordNumericArray[n].Icon;
        If(FIO.Exists(icon)) then
        begin
          Substitute.SubstAll(icon,'','/');
          WebGMaps1.Markers.Add(lat,lon, Title, icon, true, true, true, false, false, 0, icDefault, -1, -1, -1, -1, '');
        end;

How can this be put together with the source above?

Sincerely Peter
Hi,

You can find a full example of how to add a label to a marker in the TWebGMaps DirectionsDemo.

This is the relevant code from the demo:

var
  Marker: TMarker;
begin
  Marker := WebGMaps1.Markers.Add;
  Marker.Latitude := Route.Legs[0].StartLocation.Latitude;
  Marker.Longitude := Route.Legs[0].StartLocation.Longitude;
  Marker.Title := 'Start Location';
  Marker.MapLabel.Text := 'Start Location: ' + Route.Legs[0].StartAddress;
  WebGMaps1.CreateMapMarker(Marker);

Hello,


Thank you for the example. Now I have added the labels to every marker.

Sincerely Peter

I can't see the way that this might get done with WebOSMaps markers. Is it possible?

Hi,


Unfortunately marker labels are currently not supported in TWebOSMaps. This is a limitation of the version of the OpenLayers API which TWebOSMaps is based on.

Alternatively you can try using TMS VCL WebGMaps or TMS FNC Maps instead.