Note that there are some explanatory texts on larger screens.

plurals
  1. POAccessor to the Point's information of a placemark to modify the altitude
    primarykey
    data
    text
    <p>I have a web working with google-earth API where I use multiple KML layers to show data.</p> <p>With the interactions of the user it's necessary to modify some properties of the placemark like styles and names in order to change the placemarks display information.</p> <p>In some cases I would like to modify at the <code>Altitude</code> of the placemarks, information included in the <code>Point</code> information of the geometry specified at the KML. Actually it is <code>clampedToGround</code> and I would like to modify it to any number in order to be in top of other elements.</p> <p>This is an example of how I modify the placemarks information:</p> <pre><code>var pm = ge.getElementByUrl(UrlOfLayer#IdOfPlacemark); pm.setStyleUrl(UrlOfLayer#IdOfStyleMap); pm.setName(NewName); </code></pre> <p>This is working perfectly and all changes are applied without any problem. The structure of the KML placemarks is as it follows:</p> <pre><code>&lt;Placemark id="1"&gt; &lt;name&gt;Name&lt;/name&gt; &lt;visibility&gt;1&lt;/visibility&gt; &lt;open&gt;0&lt;/open&gt; &lt;Point&gt; &lt;extrude&gt;1&lt;/extrude&gt; &lt;tessellate&gt;1&lt;/tessellate&gt; &lt;altitude&gt;clampedToGround&lt;/altitude&gt; &lt;coordinates&gt;1,1,1&lt;/coordinates&gt; &lt;/Point&gt; &lt;styleUrl&gt;#style&lt;/styleUrl&gt; &lt;/Placemark&gt; </code></pre> <p>With this structure and the Placemark in Javascript got by <code>getElementByUrl</code> I can access the fields name, visibility, etc just by <code>getName()</code>, <code>getVisibility()</code>, etc. But, this doesn't work with Point information, since that is included inside the <code>Geometry</code> object of the placemark.</p> <p>I can access the Geometry information by using <code>pm.getGeometry()</code>, but after that, the 'Point' can't be accessed because as Google earth documentation sais: </p> <blockquote> <p>The KmlGeometry object is an abstract object and cannot be used directly. It provides a placeholder object for all derived Geometry objects.</p> </blockquote> <p>Looking at some examples where the Point information is used, it's only used to create a Point and after that include it at the Geometry, but in my case I can't create the point in Javascript because I can't get the coordinates information and the new point would overwrite it.</p> <p>So, is there any accessor I haven't been able to find to accomplish this purpose?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload