layered polygons rendering

14 views
Skip to first unread message

Patrick

unread,
Mar 31, 2008, 4:49:57 PM3/31/08
to KML Developer Support - Advanced Support for KML
The following KML render polygons from two groups.
The larger polygon and small polygon should render on top of the green
midsize one.
This example show that small one is rendering under the midsize one.


<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>test.kml</name>
<Style id="sh_ylw-pushpin_copy5">
<IconStyle>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</
href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
<LineStyle>
<color>ff00ffaa</color>
</LineStyle>
<PolyStyle>
<color>ff00ffaa</color>
</PolyStyle>
</Style>
<Style id="sh_ylw-pushpin_copy0">
<IconStyle>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</
href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
<LineStyle>
<color>ff00aaff</color>
</LineStyle>
<PolyStyle>
<color>ff7faaff</color>
</PolyStyle>
</Style>
<Style id="sn_ylw-pushpin_copy5">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</
href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" units="pixels"/>
</IconStyle>
<LineStyle>
<color>ff00ffaa</color>
</LineStyle>
<PolyStyle>
<color>ff00ffaa</color>
</PolyStyle>
</Style>
<StyleMap id="msn_ylw-pushpin_copy0">
<Pair>
<key>normal</key>
<styleUrl>#sn_ylw-pushpin_copy0</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#sh_ylw-pushpin_copy0</styleUrl>
</Pair>
</StyleMap>
<StyleMap id="msn_ylw-pushpin_copy4">
<Pair>
<key>normal</key>
<styleUrl>#sn_ylw-pushpin_copy4</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#sh_ylw-pushpin_copy4</styleUrl>
</Pair>
</StyleMap>
<Style id="sn_ylw-pushpin_copy0">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</
href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" units="pixels"/>
</IconStyle>
<LineStyle>
<color>ff00aaff</color>
</LineStyle>
<PolyStyle>
<color>ff7faaff</color>
</PolyStyle>
</Style>
<StyleMap id="msn_ylw-pushpin_copy5">
<Pair>
<key>normal</key>
<styleUrl>#sn_ylw-pushpin_copy5</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#sh_ylw-pushpin_copy5</styleUrl>
</Pair>
</StyleMap>
<Style id="sh_ylw-pushpin_copy4">
<IconStyle>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</
href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
<LineStyle>
<color>ff00aaff</color>
</LineStyle>
<PolyStyle>
<color>ff7faaff</color>
</PolyStyle>
</Style>
<Style id="sn_ylw-pushpin_copy4">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</
href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
<LineStyle>
<color>ff00aaff</color>
</LineStyle>
<PolyStyle>
<color>ff7faaff</color>
</PolyStyle>
</Style>
<Folder>
<name>test</name>
<open>1</open>
<Folder>
<name>top</name>
<Placemark>
<name>larger</name>
<styleUrl>#msn_ylw-pushpin_copy0</styleUrl>
<Polygon>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
-118.1404846539799,48.54718939016117,0
-118.1349135367779,48.46900320048199,0
-118.0456331121671,48.47411450807715,0
-118.0592792034245,48.552268041792,0
-118.1404846539799,48.54718939016117,0 </coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<Placemark>
<name>small szie</name>
<styleUrl>#msn_ylw-pushpin_copy4</styleUrl>
<Polygon>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
-118.0294694800251,48.51512164127791,0
-118.0281738079975,48.50406277474957,0
-118.0208705034375,48.50457827983837,0
-118.0247738655308,48.51512002385941,0
-118.0294694800251,48.51512164127791,0 </coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
</Folder>
<Folder>
<name>bottom</name>
<Placemark>
<name>midsize</name>
<styleUrl>#msn_ylw-pushpin_copy5</styleUrl>
<Polygon>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
-118.0685991966032,48.52783804577032,0
-118.0643364242297,48.48889685074179,0
-118.0127859932157,48.48845296831494,0
-118.0279854182784,48.52936295765097,0
-118.0685991966032,48.52783804577032,0 </coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
</Folder>
</Folder>
</Document>
</kml>

ManoM

unread,
Apr 1, 2008, 3:07:45 PM4/1/08
to KML Developer Support - Advanced Support for KML
Hi Patrick,

KML doesn't have any way directly to indicate z-order for a Polygon.
However, you can simply put it at a higher altitude, say 1 meter, and
that should work. It worked for me.

Mano

stillinorbit

unread,
Apr 1, 2008, 3:20:54 PM4/1/08
to KML Developer Support - Advanced Support for KML
You might want to see this thread for a workaround. Good luck.

http://groups.google.com/group/kml-support-advanced/browse_frm/thread/f1dd49bb1533e4ba/ae0eb57784376caa?lnk=gst&q=polygon+draw+order#

Stu

On Mar 31, 1:49 pm, Patrick wrote:

Patrick

unread,
Apr 1, 2008, 6:38:31 PM4/1/08
to KML Developer Support - Advanced Support for KML
It works. Thanks you guys.
Reply all
Reply to author
Forward
0 new messages