1

In my Delphi app I use GMlib for the first time and I sucessfully displayed a map with an airline route and all markers. I use a GMMap, GMMarker, GMPolyline components

However I would like to replace normal marker icons by littles red circles (3-4 pixels radius). Here is the code I use to plot the map and route:

procedure TfrmWebBrowser.PlotMap;
var
  aList1,
  aList2: TstringList;
  dLatitude,
  dLatitude1,
  dLatD,
  dLonD,
  dLongitude,
  dLongitude1: Single;
  i: Integer;
  Poly: TPolyline;
  begin
    Poly:= TPolyline(GMPolyline1.Add);
    Poly.StrokeColor:= clRed;
    Poly.StrokeWeight:= 1;
    aList1:= TstringList.Create;
    aList1.StrictDelimiter:= True;
    aList1.Delimiter:= ';';
    aList2:= TstringList.Create;
    aList2.StrictDelimiter:= True;
    aList2.Delimiter:= ';';
    GMMarker1.Clear;
    for i := 0  to GstlMapPoints.Count-1 do
    begin
      aList1.DelimitedText:= GstlMapPoints.Strings[i];
      if i > 0 then
      begin
        aList2.DelimitedText:= GstlMapPoints.Strings[i - 1];
        dLatitude:= StrToFloat(aList2[0]);
        dLatitude1:= StrToFloat(aList1[0]);
        dLongitude:= StrToFloat(aList2[1]);
        dLongitude1:= StrToFloat(aList1[1]);
        Poly.AddLinePoint(dLatitude,dLongitude);
        Poly.AddLinePoint(dLatitude1,dLongitude1);
        Poly.Geodesic:= True;
      end
      else
      begin
        dLatD:= StrToFloat(aList1[0]);
        dLonD:= StrToFloat(aList1[1]);
      end;
    dLatitude:= StrToFloat(aList1[0]);
    dLongitude:= StrToFloat(aList1[1]);
    GMMarker1.Add(dLatitude, dLongitude, aList1[2]);
  end;
  GMMarker1.ZoomToPoints;
  aList1.Free;
  aList2.Free;
end; 

Would ypu help me to do that? Thanks Pierre

RRUZ
  • 134,889
  • 20
  • 356
  • 483

1 Answers1

2

The Add method from TGMMarker class return a TMarker object. This object have a Icon property to set the image to display

var
  Marker: TMarker
begin
  .....
  Marker := GMMarker1.Add(dLatitude, dLongitude, aList1[2]);
  Marker.Icon := 'http://www.cadetill.com/imagenes/gallery/gmlib/marker.png'
  .....

The image must be on the web or in your local PC

cadetill
  • 1,552
  • 16
  • 24