I'm seeing rendering differences between the first time a page is loaded and subsequent reloads (caused by pressing the browser refresh button). In the latter case, often features (such as placemarks or polygons) are rendered as if with altitudes based upon terrain elevation data that is current at the time of feature rendering but will later be updated as more granular elev data arrives -- but the rendering/altitudes for the features will not be updated.
This seems to happen on reloads, not on the initial page load. The effect is most obvious in rough terrains, where subsequently-arriving elev data can be quite different from early data.
Here's a demonstration: http://jsfiddle.net/x4PEM/1/ Note the shape of the polygon on the initial load, then press 'run' to cause a refresh. Note rendering differences.
If the feature happens to get an altitude that is below the final terrain elevation, the feature may not be rendered at all (until the user maybe causes a re-rendering by tilting, etc).
Is there something wrong with my code (which is based upon Google samples)? Is there a way to prevent this from happening (maybe an event I need to catch to delay feature rendering until elev data has been received)? Is it a bug that should be reported to Google?
(I noticed this because I've been writing code with a text editor and then press refresh on a browser to see the results; similar to pressing 'run' on jsFiddle. End-users wouldn't be doing refreshes as intensively, but still, they may press refresh.)
Here's the code:
var ge;
google.load("earth", "1");
function init() {
google.earth.createInstance('map3d', initCB, failureCB);
}
function initCB(instance) {
ge = instance;
ge.getWindow().setVisibility(true);
var lat = 37.204193;
var lon = -112.934429;
var dlat = 0.005;
var dlon = 0.005;
var alt = 100;
var la = ge.createLookAt('');
la.set(lat, lon, 0, ge.ALTITUDE_RELATIVE_TO_GROUND, 0, 45, 2000);
ge.getView().setAbstractView(la);
var polygonPlacemark = ge.createPlacemark('');
var polygon = ge.createPolygon('');
polygon.setAltitudeMode(ge.ALTITUDE_RELATIVE_TO_GROUND);
polygonPlacemark.setGeometry(polygon);
var outer = ge.createLinearRing('');
outer.setAltitudeMode(ge.ALTITUDE_RELATIVE_TO_GROUND);
outer.getCoordinates().pushLatLngAlt(lat + dlat, lon - dlon, alt);
outer.getCoordinates().pushLatLngAlt(lat + dlat, lon + dlon, alt);
outer.getCoordinates().pushLatLngAlt(lat - dlat, lon + dlon, alt);
outer.getCoordinates().pushLatLngAlt(lat - dlat, lon - dlon, alt);
polygon.setOuterBoundary(outer);
polygonPlacemark.setStyleSelector(ge.createStyle(''));
polygonPlacemark.getStyleSelector().getPolyStyle().getColor().set('ff008000');
ge.getFeatures().appendChild(polygonPlacemark);
}
function failureCB(errorCode) {
alert("GE init failed");
}
google.setOnLoadCallback(init);