Using available SytleURL icons in a KML file

971 views
Skip to first unread message

yelkenli

unread,
Jul 11, 2008, 6:17:10 PM7/11/08
to KML Developer Support - Getting Started with KML
I am creating some short KML files and would like to change the icon
type from "Yellow Pushpin". I am only creating points in GE. But to
get different points to standout, I would like to change the icon
(such as to a pink balloon).

I would like to use the defaults that are available already in my GE
file. For example, I have yellow and blue pushpins, ping balloons, red
crosses from a coworker's kmz file.

My problem is I do not know how to refer to different icons in my
KML.

My prefered method is to refer to these using <styleurl>.

However, when I enter
http://maps.google.com/mapfiles/kml/paddle/pink-blank.png
or
#s_C

either for URL or local source, I get only the yellow pushpin. this
tells me the KML upload is ignoring the information, probably because
it is incorrect. maybe?

How do I find the styles that are available (already loaded). I would
like to not code new styles each time. The closest I have gotten is
finding userpallet.kml in the C:\Program Files\Google\Google Earth\res
directory. However, when trying to reference the styles listed there,
I still get the default yellow pushpin.

Thanks,
Ted

yelkenli

unread,
Jul 11, 2008, 6:17:10 PM7/11/08
to KML Developer Support - Getting Started with KML

ManoM

unread,
Jul 13, 2008, 11:30:25 AM7/13/08
to KML Developer Support - Getting Started with KML
Hi Ted,

Can you post your KML file? You can either put it on line somewhere
and post a URL, or post it in the Files section of this group.

Mano

On Jul 11, 3:17 pm, yelkenli wrote:
> I am creating some short KML files and would like to change the icon
> type from "Yellow Pushpin".   I am only creating points in GE. But to
> get different points to standout, I would like to change the icon
> (such as to a pink balloon).
>
> I would like to use the defaults that are available already in my GE
> file. For example, I have yellow and blue pushpins, ping balloons, red
> crosses from a coworker's kmz file.
>
> My problem is I do not know how to refer to different icons in my
> KML.
>
> My prefered method is to refer to these using <styleurl>.
>
> However, when I enterhttp://maps.google.com/mapfiles/kml/paddle/pink-blank.png

yelkenli

unread,
Jul 14, 2008, 9:28:14 AM7/14/08
to KML Developer Support - Getting Started with KML
I uploaded to the "Files" section of this group, a file called

CSA Coupon Sites.kml

in it you will see I am using the StyleURL code. I was thinking there
are a few default styles already defined, and I can just use those, as
I don't need too many, and don't need anything special.

to make the KML file, I have a table of points (in excel). Above the
table, I have a cell where I can type in the name of my desired style.
I coded excel VBA to pick that up and put it into the KML file.

The file I uploaded is an example.

Thanks,
Ted
> > Ted- Hide quoted text -
>
> - Show quoted text -

ManoM

unread,
Jul 14, 2008, 11:18:47 AM7/14/08
to KML Developer Support - Getting Started with KML
Hi Ted,

You have to define a style which includes the icon you want to use. It
would look something like this:

<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Style id="s_C">
<IconStyle>
<Icon>
<href>http://maps.google.com/mapfiles/kml/paddle/pink-
blank.png</href>
</Icon>
</IconStyle>
</Style>
<Placemark>
<name></name>
<styleUrl>#s_C</styleUrl>
...

If you want the style shared by many Placemarks, you must define it at
the Document level.

Check out this part of the tutorial for more information on Styles:
http://code.google.com/apis/kml/documentation/kml_tut.html#geometrystyles

Mano

yelkenli

unread,
Jul 15, 2008, 5:38:37 PM7/15/08
to KML Developer Support - Getting Started with KML
Thanks for the feedback. You might be pointing out some additional
improvements to my file.
My KML starts off with:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Folder>

But you indicate this:
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>

Is my document out of date?

The next question is: Do I just insert the style block of code at the
top of my KML file, maybe after </name> ( or <Document> ) and before
<Placemark> of the first point?


Ted



On Jul 14, 11:18 am, ManoM wrote:
> Hi Ted,
>
> You have to define a style which includes the icon you want to use. It
> would look something like this:
>
> <kml xmlns="http://www.opengis.net/kml/2.2">
> <Document>
> <Style id="s_C">
> <IconStyle>
> <Icon>
> <href>http://maps.google.com/mapfiles/kml/paddle/pink-
> blank.png</href>
> </Icon>
> </IconStyle>
> </Style>
> <Placemark>
> <name></name>
> <styleUrl>#s_C</styleUrl>
> ...
>
> If you want the style shared by many Placemarks, you must define it at
> the Document level.
>
> Check out this part of the tutorial for more information on Styles:http://code.google.com/apis/kml/documentation/kml_tut.html#geometryst...
>
> Mano
>

ManoM

unread,
Jul 16, 2008, 1:32:46 PM7/16/08
to KML Developer Support - Getting Started with KML
Hi yelkenli,

A few months ago, KML was officially given to the Open Geospatial
Consortium (http://www.opengeospatial.org/) which now owns it and has
published it as an open standard. As such, they have changed the
namespace to http://www.opengis.net/kml/2.2. Google Earth still writes
out http://earth.google.com/kml/2.2.

Styles that you want to share should be child elements of the root
<Document> element. If you look at the documentation for <Document>:
http://code.google.com/apis/kml/documentation/kmlreference.html#document
you'll see the positioning.

Mano
Reply all
Reply to author
Forward
0 new messages