Openlayer Example with Labels in Polygons

Hi,
Is there an example of Implementation of Labels in Polygons? i am messing around with no results...

My code looks alike:
image

Please note that Polygon labels are currently only supported in OpenLayers.
Can you make sure you are using TTMSFNCOpenLayers instead of TTMSFNCMaps?

This example adds a polygon with a label to the map:

var
  c: TTMSFNCMapsCoordinateRecArray;
  p: TTMSFNCOpenLayersPolygon;
begin
  SetLength(c, 3);
  c[0].Latitude := TMSFNCOpenLayers1.Options.DefaultLatitude;
  c[0].Longitude := TMSFNCOpenLayers1.Options.DefaultLongitude;
  c[1].Latitude := TMSFNCOpenLayers1.Options.DefaultLatitude + 0.01;
  c[1].Longitude := TMSFNCOpenLayers1.Options.DefaultLongitude + 0.01;
  c[2].Latitude := TMSFNCOpenLayers1.Options.DefaultLatitude + 0.01;
  c[2].Longitude := TMSFNCOpenLayers1.Options.DefaultLongitude;

  TMSFNCOpenLayers1.BeginUpdate;
  TMSFNCOpenLayers1.ClearPolygons;
  p := TMSFNCOpenLayers1.AddPolygon(c);
  p.&Label.Text := 'Polygon Label';
  TMSFNCOpenLayers1.EndUpdate;
end;

image

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.