Display Georeferenced Image in Maps

We're using UAVs to map islands that frequently change shape faster than Google Earth updates the satellite imagery, so when we plot our missions, it often looks like the flights were over water.

Is the any way to load and display a georeferenced image made using photogrammetry like a KMZ file or image with a TFW/JGW World File?


This is possible with TTMSFNCGoogleMaps with KML/KMZ Layers:

TMSFNCGoogleMaps1.AddKMLLayer('URL TO KMZ/KML');

Not sure about the TFW/JFW world file we'll have to investigate the possibilities.


Thanks for the response, but I can't get it to work using a local file, even using a KML polygon.

This code brings up the map at the correct location and zoom, but doesn't display the KML


Map.AddKMLLayer('C:\Users\hmarn\Documents\HMA\KML Libr\LBNI\20220511 - LBNI.kml');


This same KML loads and displays fine in Google Earth

Any suggestions appreciated

This is not possible. The file needs to be accessible online because Google needs to have access to the file. Local KML / KMZ files are not possible.

Having to host KMZ files somewhere adds several new layers of complexity.

Is there no way to utilize Google Earth's ability to load and display local files in TMS FNC Maps?

Something like load the file in Google Earth and then reference that display or cache?

Any way to load the files in the local instance of Google Earth and then save then in some other form for use in Maps?

Below is an example of a Orthomosaic loaded in Google Earth from a local, hard drive, based KMZ file


Supposedly, Google Earth uploads the KML file to a server and then parses it or uses the link pointing to that file. In Google Maps, this is not possible.

There is currently no support to parse offline/local KML files.

Thanks again for the response

I just came across the "Overlay" capability of TMS FNC Maps

It seems I might be able to end up at the same place using a carefully positioned and sized orthomosaic JPG.

The Guide PDF shows another web-based file for that.

Can overlays be loaded using local files?

Now I understand your point - I'm confusing Google Earth with Google Maps


You can base64 the image and then add an overlayview within specific bounds. Like demonstrated in the code below.

procedure TForm1.Button1Click(Sender: TObject);
  ov: TTMSFNCGoogleMapsOverlayView;
  b64: string;

  ov := TMSFNCGoogleMaps1.AddOverlayView;
  b64 := 'data:image/jpeg;base64,' + TTMSFNCUtils.FileToBase64('C:\Users\TMS\Downloads\newark_nj_1922-661x516.jpeg');
  ov.Text := '<img src="' + b64 + '" style="position:absolute;width:100%;height:100%;">';
  ov.Bounds.NorthEast.Latitude := 40.773941;
  ov.Bounds.NorthEast.Longitude := -74.12544;
  ov.Bounds.SouthWest.Latitude := 40.712216;
  ov.Bounds.SouthWest.Longitude := -74.22655;
  ov.Mode := omBounds;
  ov.Padding := 0;
  ov.BackgroundColor := gcNull;
  ov.BorderColor := gcNull;

This works very well and loads much faster than a medium resolution KMZ.

Will it work with a TIFF file set for invisible background?


I suppose you can load any kind of image, so PNG, which supports transparency by default, should be possible. Then the b64 conversion looks like

b64 := 'data:image/png;base64,' + TTMSFNCUtils.FileToBase64('MyImage.png');


I can't get it to work with anything except JPG files, which don't support transparency

In your example, you use the 4 letter for code JPEG, so for TIFF Files I've tried TIF as well as TIFF.

Neither of those or using PNG images seem to load, although you can see the outline of a bounding box on the map

I emailed you an example of a TIFF image with a transparent backgound.

Could you please see if you can get that to load, and send me the code you use?



Your code works well for JPG images of various sizes, but I have yet to be able to get any TIFF or PNG images to load.

Could you please provide example code and a sample image for displaying either a TIFF or PNG?

Thanks in advance

This demo shows a PNG with transparency.

Demo.zip (96.9 KB)

The image is included.


Works perfectly.

Turns out the way I was converting from TIFF to PNG was wrong. Using a photo editing program (in my case Affinity) to load the TIFF then export to PNG did the trick.

Using this method and the image parameters in a TFW "World File" lets you load and display even quite detailed orthomosaic images into Google Maps.

The registration of clicking on a spot on the orthomosaic, then looking at the returned lat/lon coordinates appears excellent.

Powerful tool, thanks again for your help

Nice! Thanks for the update.