Transparency of Image overlay on Google Earth (kmz file)

5 views (last 30 days)
Hello,
My purpose is to obtain a contour map using basic Latitude, Longitude, Height/depth data of a location and overlay the image on Google earth using kml toolbox. I was looking for something simlper and this is what I have so far. (Apologies for any mistakes in code, I'm not very comfortable with MATLAB yet)
% reading the bathy data
data = xlsread('./BathymetryData.xlsx');
lon = data(:,1);
lat = data(:,2);
alt = data(:,3);
[xq,yq] = meshgrid(min(lon):.001:max(lon), min(lat):.001:max(lat));
[x,y,z] = griddata(lon,lat,alt,xq,yq, 'cubic');
contour(z,'showtext', 'on','color','b');
saveas(gcf, 'contour.png');
F = getframe(gca);
imwrite(F.cdata, 'contour.png');
% Save it as KMZ.
k = kml('image.kml');
k.overlay(a, b, c, d, 'file','contour.png');
% a, b, c, d being the minimum and maximum Longitude and Latitude values.
k.run;
I'm getting the result I want but I want the overlaying image to be transparent. If it is possible to ONLY show the lines, it would be ideal. How can I approach this?
(I'm using MATLAB R2019b)
Thanks in advance!

Answers (1)

Mehmed Saad
Mehmed Saad on 8 May 2020
Use export_fig to save transparent png

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!