Dynamic Screen Overlay Icon

305 views
Skip to first unread message

Dan Grossnickle

unread,
Apr 23, 2014, 12:58:39 PM4/23/14
to kml-suppor...@googlegroups.com
I'm looking to add a dynamic google chart URL as a screen overlay with KML. The chart image is generated by the parameters in the URL, but since the output is not an image file, I am getting an error.
I have had success adding charts to descriptions within balloons, but I cannot seem to use CDATA tags within icon style tags. Any help would be greatly appreciated. thank you.

<?xml version="1.0" encoding="UTF-8"?>
<ScreenOverlay>
<name>Chart</name>
<Icon>
</Icon>
<overlayXY x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
<screenXY x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
<rotationXY x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
<size x="0" y="0" xunits="pixels" yunits="pixels"/>
</ScreenOverlay>
</kml>

barryhunter (KML Guru)

unread,
Apr 23, 2014, 1:04:57 PM4/23/14
to kml-suppor...@googlegroups.com


On Wednesday, 23 April 2014 17:58:39 UTC+1, Dan Grossnickle wrote:
The chart image is generated by the parameters in the URL, but since the output is not an image file,

What do you mean by 'not a image file'? 
You need to use entities in XML. A bare & will not work. 

<href>http://chart.googleapis.com/chart?cht=p3&amp;chd=t:60,40&amp;chs=250x100&amp;chl=Hello|World</href>
 

Dan Grossnickle

unread,
Apr 23, 2014, 1:18:35 PM4/23/14
to kml-suppor...@googlegroups.com
Thanks Barry, worked like a charm. Any idea how to use html CDATA with the image? For example, if I wanted to put a border around the image?

barryhunter (KML Guru)

unread,
Apr 23, 2014, 1:22:25 PM4/23/14
to kml-suppor...@googlegroups.com


On Wednesday, 23 April 2014 18:18:35 UTC+1, Dan Grossnickle wrote:
 Any idea how to use html CDATA with the image? For example, if I wanted to put a border around the image?

I'm not sure how that even makes sense

Maybe you misunderstanding what CDATA means? 



Its an alternative way (other than entities) of not having to encode various charactors. 

 

Dan Grossnickle

unread,
Apr 23, 2014, 1:34:33 PM4/23/14
to kml-suppor...@googlegroups.com
Hi Barry,

I've used CDATA to customize the placemark description balloons with html. I attached a kml file as an example.
I cannot seem to get the tags to work under the <Icon> parent within screen overlay.

thanks.
BALLOON CDATA.kml

barryhunter (KML Guru)

unread,
Apr 23, 2014, 1:47:08 PM4/23/14
to kml-suppor...@googlegroups.com


On Wednesday, 23 April 2014 18:34:33 UTC+1, Dan Grossnickle wrote:
Hi Barry,

I've used CDATA to customize the placemark description balloons with html.



No. 

You used HTML to customize the description of the placemark, because Google Earth (and some other viewers) understands basic HTML for popup balloons. 


Because HTML is also XML based, it's messy including HTML directly in XML (which KML is) - so CDATA is a common way of encoding it (so the text/html can pretty much be included directly in the text). But equally could encode the HTML descriptions with entities, and not use CDATA at all. 

CDATA, like entities, is a part of the XML spec, defining how data is encoded. Not part of KML as such.  


So your problem is you would like to include HTML in the screenoverlay - well that is not possible. Just a direct URL to a image file. To change the appearance will have to change the image file itself. 

Dont remember off hand if the chart-api has options for adding borders etc. 
 

Dan Grossnickle

unread,
Apr 23, 2014, 1:51:17 PM4/23/14
to kml-suppor...@googlegroups.com
ok great, thanks for your help.

Jason M

unread,
Apr 24, 2014, 9:13:44 AM4/24/14
to kml-suppor...@googlegroups.com

Also note a discussion of CDATA restrictions with respect to KML found here:
Reply all
Reply to author
Forward
0 new messages