If you use the World borders shapefile provided on the site to create a KML prism maps, you will experience a problem. The same problem is likely to occur if you extract polygon features from other shapefiles. The prism map will look like this in Google Earth:
The prisms are not colourised properly. The reason turned out to be the clockwise orientation of the polygon vertices (winding order). 3-D implementations of KML use the vertex winding order for determining the direction in which it faces. This is necessary to display the correct lighting on curved surfaces. For the prisms to be displayed properly the vertex order has to be anti-clockwise.
The prisms will be colourised properly by simply changing the direction of the coordinates.
The light has been switched back on.
The vertex order was changed by this PHP function:
The prisms are not colourised properly. The reason turned out to be the clockwise orientation of the polygon vertices (winding order). 3-D implementations of KML use the vertex winding order for determining the direction in which it faces. This is necessary to display the correct lighting on curved surfaces. For the prisms to be displayed properly the vertex order has to be anti-clockwise.The prisms will be colourised properly by simply changing the direction of the coordinates.
The light has been switched back on.The vertex order was changed by this PHP function:
function kmlReverseCoordinates($coordinates) {
$coordinates = explode(" ", $coordinates);
$coordinates = array_reverse($coordinates);
$coordinates = implode(" ", $coordinates);
return $coordinates;
}
$coordinates = explode(" ", $coordinates);
$coordinates = array_reverse($coordinates);
$coordinates = implode(" ", $coordinates);
return $coordinates;
}
Comments
Thanks!
Maarten
www.merkador.com