I have a problem with google earth’s kml files. When I use the altitude mode clampToGround
it does perfectly what I expected it to do, it follows the ground nicely.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2">
<Document>
<name>pm1kml</name>
<Style id="poly">
<LineStyle>
<color>a000ff00</color>
</LineStyle>
<PolyStyle>
<color>a000ff00</color>
</PolyStyle>
</Style>
<Placemark>
<styleUrl>#poly</styleUrl>
<Polygon>
<extrude>0</extrude>
<tessellate>0</tessellate>
<altitudeMode>clampToGround</altitudeMode>
<outerBoundaryIs>
<LinearRing>
<coordinates>-5.255885800498265,36.11513548688032,123 -5.257614986927059,36.097578762436825,123 -5.257614986927059,36.097578762436825,123 -5.262736094548725,36.08069673306777,123 -5.262736094548725,36.08069673306777,123 -5.27105232206931,36.06513816569425,123 -5.27105232206931,36.06513816569425,123 -5.282244081528993,36.051500967335095,123 -5.282244081528993,36.051500967335095,123 -5.29588127988815,36.04030920787541,123 -5.29588127988815,36.04030920787541,123 -5.311439847261665,36.03199298035483,123 -5.311439847261665,36.03199298035483,123 -5.3283218766307225,36.02687187273316,123 -5.3283218766307225,36.02687187273316,123 -5.345878601074219,36.02514268630436,123 -5.345878601074219,36.02514268630436,123 -5.363435325517715,36.02687187273316,123 -5.363435325517715,36.02687187273316,123 -5.380317354886772,36.03199298035483,123 -5.380317354886772,36.03199298035483,123 -5.395875922260288,36.04030920787541,123 -5.395875922260288,36.04030920787541,123 -5.409513120619445,36.051500967335095,123 -5.409513120619445,36.051500967335095,123 -5.4207048800791275,36.06513816569425,123 -5.4207048800791275,36.06513816569425,123 -5.429021107599713,36.08069673306777,123 -5.429021107599713,36.08069673306777,123 -5.434142215221378,36.097578762436825,123 -5.434142215221378,36.097578762436825,123 -5.435871401650172,36.11513548688032,123 -5.435871401650172,36.11513548688032,123 -5.434142215221378,36.132692211323814,123 -5.434142215221378,36.132692211323814,123 -5.429021107599713,36.14957424069287,123 -5.429021107599713,36.14957424069287,123 -5.4207048800791275,36.16513280806639,123 -5.4207048800791275,36.16513280806639,123 -5.409513120619445,36.178770006425545,123 -5.409513120619445,36.178770006425545,123 -5.395875922260288,36.18996176588523,123 -5.395875922260288,36.18996176588523,123 -5.380317354886771,36.19827799340581,123 -5.380317354886771,36.19827799340581,123 -5.363435325517715,36.20339910102748,123 -5.363435325517715,36.20339910102748,123 -5.345878601074219,36.205128287456276,123 -5.345878601074219,36.205128287456276,123 -5.3283218766307225,36.20339910102748,123 -5.3283218766307225,36.20339910102748,123 -5.311439847261665,36.19827799340581,123 -5.311439847261665,36.19827799340581,123 -5.29588127988815,36.18996176588523,123 -5.29588127988815,36.18996176588523,123 -5.282244081528993,36.178770006425545,123 -5.282244081528993,36.178770006425545,123 -5.27105232206931,36.16513280806639,123 -5.27105232206931,36.16513280806639,123 -5.262736094548725,36.14957424069287,123 -5.262736094548725,36.14957424069287,123 -5.257614986927059,36.132692211323814,123 -5.257614986927059,36.132692211323814,123 -5.255885800498265,36.11513548688032,123 -5.255885800498265,36.11513548688032,123 -5.255885800498265,36.11513548688032,123 </coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
</Document>
When I work with relativeToGround
however, only the outer vertices follow the ground. In the middle of the circle the rock is above the green area and not 123 meters beneath it.
Image: http://nl.tinypic.com/r/2vcsvq1/8
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2">
<Document>
<name>pm1kml</name>
<Style id="poly">
<LineStyle>
<color>a000ff00</color>
</LineStyle>
<PolyStyle>
<color>a000ff00</color>
</PolyStyle>
</Style>
<Placemark>
<styleUrl>#poly</styleUrl>
<Polygon>
<extrude>0</extrude>
<tessellate>0</tessellate>
<altitudeMode>relativeToGround</altitudeMode>
<outerBoundaryIs>
<LinearRing>
<coordinates>-5.255885800498265,36.11513548688032,123 -5.257614986927059,36.097578762436825,123 -5.257614986927059,36.097578762436825,123 -5.262736094548725,36.08069673306777,123 -5.262736094548725,36.08069673306777,123 -5.27105232206931,36.06513816569425,123 -5.27105232206931,36.06513816569425,123 -5.282244081528993,36.051500967335095,123 -5.282244081528993,36.051500967335095,123 -5.29588127988815,36.04030920787541,123 -5.29588127988815,36.04030920787541,123 -5.311439847261665,36.03199298035483,123 -5.311439847261665,36.03199298035483,123 -5.3283218766307225,36.02687187273316,123 -5.3283218766307225,36.02687187273316,123 -5.345878601074219,36.02514268630436,123 -5.345878601074219,36.02514268630436,123 -5.363435325517715,36.02687187273316,123 -5.363435325517715,36.02687187273316,123 -5.380317354886772,36.03199298035483,123 -5.380317354886772,36.03199298035483,123 -5.395875922260288,36.04030920787541,123 -5.395875922260288,36.04030920787541,123 -5.409513120619445,36.051500967335095,123 -5.409513120619445,36.051500967335095,123 -5.4207048800791275,36.06513816569425,123 -5.4207048800791275,36.06513816569425,123 -5.429021107599713,36.08069673306777,123 -5.429021107599713,36.08069673306777,123 -5.434142215221378,36.097578762436825,123 -5.434142215221378,36.097578762436825,123 -5.435871401650172,36.11513548688032,123 -5.435871401650172,36.11513548688032,123 -5.434142215221378,36.132692211323814,123 -5.434142215221378,36.132692211323814,123 -5.429021107599713,36.14957424069287,123 -5.429021107599713,36.14957424069287,123 -5.4207048800791275,36.16513280806639,123 -5.4207048800791275,36.16513280806639,123 -5.409513120619445,36.178770006425545,123 -5.409513120619445,36.178770006425545,123 -5.395875922260288,36.18996176588523,123 -5.395875922260288,36.18996176588523,123 -5.380317354886771,36.19827799340581,123 -5.380317354886771,36.19827799340581,123 -5.363435325517715,36.20339910102748,123 -5.363435325517715,36.20339910102748,123 -5.345878601074219,36.205128287456276,123 -5.345878601074219,36.205128287456276,123 -5.3283218766307225,36.20339910102748,123 -5.3283218766307225,36.20339910102748,123 -5.311439847261665,36.19827799340581,123 -5.311439847261665,36.19827799340581,123 -5.29588127988815,36.18996176588523,123 -5.29588127988815,36.18996176588523,123 -5.282244081528993,36.178770006425545,123 -5.282244081528993,36.178770006425545,123 -5.27105232206931,36.16513280806639,123 -5.27105232206931,36.16513280806639,123 -5.262736094548725,36.14957424069287,123 -5.262736094548725,36.14957424069287,123 -5.257614986927059,36.132692211323814,123 -5.257614986927059,36.132692211323814,123 -5.255885800498265,36.11513548688032,123 -5.255885800498265,36.11513548688032,123 -5.255885800498265,36.11513548688032,123 </coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
</Document>
What I need is the polygon from clampToGround
lifted 123 meters. Is this possible with google earth’s kml files. If so, how do I do that?
Thanks in advance!
EDIT: It was already reported as an issue: https://code.google.com/p/kml-samples/issues/detail?id=432
There is a distinct behavioral difference between
clampToGround
andrelativeToGround
as defined in the KML specification.clampToGround by definition follows the terrain such that a polygon will wrap the surface of a mountain or hill if it intersects with the terrain.
relativeToGround on the other hand creates a plane parallel to the ground that slices through any mountains and hills as seen in the Figure below. A relativeToGround of 123 meters is a ground elevation of 123 above the ground not above the top of the rock. The relative to ground zero elevation is this instance is the base of the rock.
The Rock of Gibraltar is approximately 390 meters above the ground at the summit so a relative elevation of 123 meters slices through the rock. If you want the polygon to be 123 meters above the tip of the rock then you should make the relative altitude ~513 meters which would be like a low-hanging green cloud over that location.
Alternatively, if you want the top of the rock wrapped with a green polygon and the plane of the polygon elevated at 123 meters (slicing through the rock) then suggest you define a MultiGeometry with the second polygon with relativeToGround (as listed above) and a smaller circle just covering the tip of the rock with altitudeMode=clampToGround.
But if you want the clampToGround behavior with the polygon following the shape of terrain, but elevated above ground then you'd need to create small meshes of polygons each in relativeToGround mode.