IMPORTANT: Before filing a new bug report, check the existing bugs in this
issue tracker to ensure it has not already been entered. If it has, simply
star that bug and leave an optional comment. If you create a duplicate,
it just makes it harder to track how many people are encountering a
potential bug.
NOTE: Please read the above IMPORTANT message before continuing.
What steps will reproduce the problem?
1. Create polygon placemark using google earth plugin api
2. Attach event listener to this placemark
3. Click on the placemark and get the coordinates and the altitude from the
event properties
What is the expected output or behavior? What do you see instead?
As an example to the expected behavior you can see what happens when you point
3d building from buildings layer in the Google Earth client- the coordinates
and altitude that appear at the status bar are the coordinates of the *wall*
you point, not the coordinates of the earth surface behind the building. In
other words, the click event should return the corddinates of the ballon that
appear when the you click on the placemark.
Instead, the coordinates of the click event are on the earth surface behind the
placemark.
Which plugin version are you using?
6.2
Which browsers and operating systems are affected?
chrome,win7,64 bit
Please provide any additional information (code snippets/links) below.
just copy and paste the following code to notepad. save it as new html file and
open it.
press "create placemark" and then click on the placemark: the values from the
click event should appear in the input boxes. note that the values are of the
point that the click hit on the earth surface. If you, for example, tilt the
view so the sky would be behind the placemark , the values you will get from
the click event would be 0,0,0.
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
var ge;
google.load("earth", "1");
function init() {
google.earth.createInstance('map3d', initCB, failureCB);
}
function initCB(instance) {
ge = instance;
ge.getWindow().setVisibility(true);
}
function failureCB(errorCode) {
}
google.setOnLoadCallback(init);
function createPlacemark(){
var polygonPlacemark = ge.createPlacemark('Polygon');
var polygon = ge.createPolygon('');
polygon.setAltitudeMode(ge.ALTITUDE_ABSOLUTE);
polygonPlacemark.setGeometry(polygon);
var outer = ge.createLinearRing('');
polygon.setOuterBoundary(outer);
polygonPlacemark.setDescription('test');
var coords = outer.getCoordinates();
coords.pushLatLngAlt(35.3,33.3544921875,1200);
coords.pushLatLngAlt(35.35,33.3544921875,1200);
coords.pushLatLngAlt(35.35,33.3544921875,1000);
coords.pushLatLngAlt(35.3,33.3544921875,1000);
ge.getFeatures().appendChild(polygonPlacemark);
lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
lookAt.setLatitude(35.33);
lookAt.setLongitude(33.3544921875);
lookAt.setRange(4500);
lookAt.setTilt(45);
lookAt.setHeading(90);
// Update the view in Google Earth
ge.getView().setAbstractView(lookAt);
google.earth.addEventListener(polygonPlacemark , 'click', doEvent);
}
function doEvent(event) {
document.getElementById("alt").value=event.getAltitude();
document.getElementById("lon").value=event.getLongitude();
document.getElementById("lat").value=event.getLatitude();
}
</script>
</head>
<body>
<div id="map3d" style="height: 820px; width: 1680px;"></div>
<button id="bCreatePlacemark" type="button" onclick="createPlacemark()">Create Placemark</button><br>
<input id="lon" /><br>
<input id="lat" /><br>
<input id="alt" />
</body>
</html>
Original issue reported on code.google.com by Beautifu...@gmail.com on 8 Jun 2013 at 8:07
Original issue reported on code.google.com by
Beautifu...@gmail.com
on 8 Jun 2013 at 8:07