Multiple polygons with different <polystyle> fill color?

3,600 views
Skip to first unread message

Joerg R.

unread,
Jun 23, 2010, 6:28:41 AM6/23/10
to KML Developer Support - Getting Started with KML
Hi Group.

im wondering how to show multiple polygons each one declared with a
different style id.

below is an example file with 3 polygons and 2 styles, which is not
working as expected. on google maps, the polystyle values are used as
declared in style #b, wheter the linestyle is applied correctly as
defined in style #a and style#b.


kml;
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns: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">
<Document>
<nameTest</name>

<Style id="a">
<BalloonStyle>
<text><![CDATA[<font font size='3' color="#aa0000"><b>Test A</b></
font>]]></text>
</BalloonStyle>
<LineStyle>
<color>ffffFF00</color>
<width>3</width>
</LineStyle>
<PolyStyle>
<color>7fff0000</color>
<fill>1</fill>
<outline>1</outline>
</PolyStyle>
</Style>

<Style id="b">
<BalloonStyle>
<text><![CDATA[<font font size='3' color="#aa0000"><b>Test B</b></
font>]]></text>
</BalloonStyle>
<LineStyle>
<color>ff00FF00</color>
<width>3</width>
</LineStyle>
<PolyStyle>
<color>7faa0000</color>
<fill>1</fill>
<outline>1</outline>
</PolyStyle>
</Style>


<Placemark id="42">
<name>Test A</name>
<description></description>
<Snippet maxLines="0"></Snippet>
<styleUrl>#a</styleUrl>
<Polygon>
<extrude>1</extrude>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
...</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>

<Placemark id="43">
<name>Test A</name>
<description></description>
<Snippet maxLines="0"></Snippet>
<styleUrl>#a</styleUrl>
<Polygon>
<extrude>1</extrude>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
...</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>

<Placemark id="51">
<name>Test B</name>
<description></description>
<Snippet maxLines="0"></Snippet>
<styleUrl>#b</styleUrl>
<Polygon>
<extrude>1</extrude>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
...</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>

</Document>
</kml>



thank you
joerg

Jason M

unread,
Jun 23, 2010, 3:56:38 PM6/23/10
to KML Developer Support - Getting Started with KML
Hi.

Take a look at your polygon colors

style.a
<color>7f ff 00 00</color>

style.b
<color>7f aa 00 00</color>

One poly is set with ff for dark blue color and other with aa
purplish. Transparency for both=7f.
Try more distinct colors like red and green.

Also might be a typo when you pasted but the start name element is not
closed.
<nameTest</name>

See examples of this in tutorial at http://code.google.com/apis/kml/documentation/kml_tut.html
http://code.google.com/apis/kml/documentation/kmlreference.html#colorstyle

http://code.google.com/apis/kml/documentation/KML_Samples.kml

On Jun 23, 6:28 am, Joerg R. wrote:
> Hi Group.
>
> im wondering how to show multiple polygons each one declared with a
> different style id.
>
> below is an example file with 3 polygons and 2 styles, which is not
> working as expected. on google maps, the polystyle values are used as
> declared in style #b, wheter the linestyle is applied correctly as
> defined in style #a and style#b.
>
> ...
>
> thank you
> joerg

Joerg R.

unread,
Jun 28, 2010, 7:03:51 AM6/28/10
to KML Developer Support - Getting Started with KML
Thanks that did the trick!
My bad i spent hours on debuggin and just had to use more distinct
colors...



On 23 Jun., 21:56, Jason M wrote:
> Hi.
>
> Take a look at your polygon colors
>
> style.a
>  <color>7f ff 00 00</color>
>
> style.b
>  <color>7f aa 00 00</color>
>
> One poly is set with ff for dark blue color and other with aa
> purplish. Transparency for both=7f.
> Try more distinct colors like red and green.
>
> Also might be a typo when you pasted but the start name element is not
> closed.
>  <nameTest</name>
>
> See examples of this in tutorial athttp://code.google.com/apis/kml/documentation/kml_tut.htmlhttp://code.google.com/apis/kml/documentation/kmlreference.html#color...
Reply all
Reply to author
Forward
0 new messages