Transparent PNG images on TTMDFNCOpenLayers map not transparent

I have placed a PNG image with transparent areas onto a TTMSFNCOpenLayers map using TTMSFNCMapImage. At both design time and run time the image is there but the transparent areas are not transparent. I tried calling TMSFNCMapImage.DisableBackground without success. Is it the case that TTMSFNCOpenLayers does not support transparency for TTMSFNCMapImage?
Is there another method I could use? I want to use pixel coordinates rather that latitude and longitudes to position the image.
Thanks,
Rod

You can use ElementContainers to display transparent images at an absolute position on top of the map.

procedure TForm1.TMSFNCMaps1MapInitialized(Sender: TObject);
var
  el: TTMSFNCMapsElementContainer;
begin
  el := TMSFNCMaps1.ElementContainers.Add;
  el.HTML.Add('<img src="https://www.tmssoftware.com/site/img/tmslogo.png" style="width:50%">');
  el.UseDefaultStyle := False;
  el.Position := poBottomLeft;
end;

If you're using a local image file, please make sure to also set LocalFileAccess to True.

Thanks Bart.
I'm aware of this method, but I'm wanting to set the x,y pixel coordinates of the image, not just setting it to lower left or similar.
Surely there is a way to place a transparent image over the top.of the map at any location. The TTMSFNCImage allows an image be set with Left and Top but it doesn't seem to support transparency. Any other ideas?
Thanks.

Hi Rodney,

Please note that the map is displayed in a web browser. This is a limitation of the web browser.

To position a transparent image with pixel coordinates, you can use a workaround with inline CSS in combination with an ElementContainer.

procedure TForm1.TMSFNCMaps1MapInitialized(Sender: TObject);
var
  el: TTMSFNCMapsElementContainer;
begin
  el := TMSFNCMaps1.ElementContainers.Add;
  el.HTML.Add('<img src="https://www.tmssoftware.com/site/img/tmslogo.png" style="width: 250px; position: absolute; top: 100px; left: 50px;">');
  el.UseDefaultStyle := False;
  el.Position := poTopLeft;
end;

We'll have to investigate if pixel positioning can be added as a Position type for ElementContainers in a future version of TMS FNC Maps.

That solution works well, thanks Bart. :)

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