Add multiple polygons

Hello TMS teams,

I tried to add multiple TTMSFNCMapsPolygon to TMSFNCGoogleMaps through iteration of a set of data, but haven't succeeded yet.

// etc
for iLoop := 0 to data.Count -1 do
begin
  arrPoints := doSomething(); // return TTMSFNCMapsCoordinateRecArray
  arcPoly := gmap.AddPolygon(arrPoints);
  arcPoly.StrokeColor := clRed;
  // etc
end;

the polygons are not showing on the map, what did i do wrong? please help

Did you add gmap.BeginUpdate; and gmap.EndUpdate; around the code?

Yes i have those around

// ...
gmap.BeginUpdate;
gmap.Markers.Clear;
gmap.Markers.Recreate;
gmap.Polygons.Clear;
gmap.Polygons.Recreate;
// ...
for iLoop := 0 to data.Count -1 do
begin
  // add marker
  gmap.addMarker(coordinate);
  // ...
  // draw polygon
  arrPoints := doSomething(); // return TTMSFNCMapsCoordinateRecArray
  arcPoly := gmap.AddPolygon(arrPoints);
  arcPoly.StrokeColor := clRed;
  // ...
end;
// ...
gmap.EndUpdate;
// ...

in my code, adding multiple markers was successful, but nothing happen to polygon, i wonder why.
but if the marker & polygon not in a loop (single marker & polygon), both will shown on the map

Can you send us the exact code, as well as the coordinate list so we can investigate and try to reproduce this issue here?

Hello Pieter, thanks for your responses.
after struggling a while i'm finally got it works. i found that my code a little buggy. in general i used a procedure to calculate points for polygons using ExecuteJavascript, that's how my polygon won't show, some calculation error in my place.

i'm sorry if i'm unable to share any further code due to my company policy.
thank you, you can close this thread now.

Thank you for confirming!

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