This object is in archive! 

KML ScreenOverlay doesn`t support a transparency

elmuSSo shared this problem 10 years ago
Solved

I just tried to use semi-transparent ScreenOverlay in loaded KML file, and transparency doesn`t work.


<?xml version="1.0" encoding="UTF-8"?>


<kml :gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">


<ScreenOverlay>


<name>NAME</name>


<open>1</open>


<color>6bffffff</color>


<drawOrder>99</drawOrder>


<Icon>


<href>http://dummyimage.com/200x70/ffffff/00.png?text=TAY15C:+0.2km+262km/h</href>;


</Icon>


<overlayXY x="0" y="0.5" xunits="fraction" yunits="fraction"/>


<screenXY x="0" y="101" xunits="pixels" yunits="pixels"/>


<rotationXY x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>


<size x="-1" y="-1" xunits="pixels" yunits="pixels"/>


</ScreenOverlay>


</kml>


This works fine in Google Earth (Overlay is semi-transparent), but it does not in Locus ( Overlay is just white).

Replies (9)

photo
0

you`re maybe first who use this "secret" function


it`s not well tested anyway this problem is fixed now

photo
0

If by "secret" you think about ScreenOverlay, I`m really happy to be it`s first tester:) It is amazing! It is a way of transmitting information back from server to Locus. Very cool indeed. To be honest I`m really amazed with your implementation of KML/Network KML. I`m testing its features and everything works so nice. I think it is one of the most powerful features in Locus. I`m comparing its behaviour with Google Earth behaviour and you did really good job. Congrats. Small problems like the one above and lack of HTTPS support and micro-icons generation still exists, but they are minor in comparison to overall functionality of you KML implementation. Respect.

photo
0

thanks. I`m also sometimes also surprised that it works :)


When there will be some free time, I have to do tree structure like in Google Earth to allow some better features, like selecting specific objects, settings transparency to GroundOverlays etc. but ... later (not so important now)

photo
0

This will be Pr0! But as you said, not important. It is more important to just mimic a behaviour of Google Earth. I will try to help you with that:)

photo
0

I just discovered that dynamic icon-colouring (with transparency) work like a charm. Perfect!

photo
0

Confirmed. It is solved. Great job!

photo
0

I just found another error related to that. maybe error is a too big word.


It is inconsistency with the Google Earth behaviour:


I`m using this image as a ScreenOverlay


Here are the effects:


1. Image is an effect in Google Earth with color = 99000000


2. This is also in Google Earth, but with color = 99FFFFFF


3. Is the effect of the both above in Locus. For both above colour values, the effect in Locus is the same.


Of course it looks fine in both configurations in Locus, but inconsistency between clients (fragmentation) can lead to the situation that the programmer will need to make additional conditional clauses to differentiate between clients ( Locus vs. GE) and implement a relevant behaviour for each.


The above example is trivial,, but you never know how this will behave with different colours and transparencies. And I believe you would like to have keep your "secret feature" good:)

photo
0

Same situation occurs in Iconstyle->Color

photo
0

I have created a Autohotkey script to inject into a KMZ file a transparency that you can select.


It requires that 7za.exe in the same directory as the script, or in your system common path.


Save the text below to a .ahk file and enjoy. Cheers :-)


#SingleInstance,Force


#Persistent


#NoTrayIcon


StrTempPath = c:KMLTransparency


;select KMZ file


FileSelectFile, StrKMZInputFile


;stuff we need to create a tidy output file name


StringGetPos, IntPointPosition, StrKMZInputFile, ., R1


StringMid, StrKMZOutputFile, StrKMZInputFile, 1, %IntPointPosition%


;create a temp dir on C


FileCreateDir, %StrTempPath%


;extract the KMZ to temp dir


CMD = %A_ScriptDir%7za.exe x -y -o%StrTempPath% %StrKMZInputFile%


RunWait, %CMD%,, Hide


;input the transparency


InputBox, HexTransparency, Input transparency in Hex [00-ff],,,,100,,,,,80


;define the output KMZ file name


StrKMZOutputFile = %StrKMZOutputFile%_transp%HexTransparency%.kmz


FileSelectFile, StrKMZOutputFile, , %StrKMZOutputFile%, , *.kmz


;get the KML file name


loop, %StrTempPath%*.kml


StrKMLInputFile = %A_LoopFileFullPath%


;temporary kml file with injected transparency


StrKMLOutputFile = %StrTempPath%doc2.kml


loop, read, %StrKMLInputFile%


{


IfNotInString, A_LoopReadLine, ;remove lines with transparency if already there


{


fileappend, %A_LoopReadLine%`n, %StrKMLOutputFile%


}


ifinstring, A_LoopReadLine,


{


;inject transparency


fileappend, `t`t%HexTransparency%ffffff`n, %StrKMLOutputFile%


}


}


;replace the original KML with the new temp KML file


filemove, %StrTempPath%doc2.kml, %StrKMLInputFile%, 1


;filedelete, %StrKMZOutputFile%


;compress the KML and its bitmaps to a KMZ (that is a zip file)


CMD = %A_ScriptDir%7za.exe a -y -r -tzip %StrKMZOutputFile%


RunWait, %CMD%, %StrTempPath%, Hide


;remove the temp dir on C:


FileRemoveDir, %StrTempPath%, 1


IfExist, %StrKMZOutputFile%


MsgBox, Operation successful


return

Replies have been locked on this page!