How to download a map of Google Earth and not start from space?

I have an installed view that you can start by downloading the Google Earth API from my website, but it starts from a place and then zooms in, rather than starting from this enlarged view. This is attractive to the viewer, especially because my view is from north to south, so the Earth makes a whirlwind on the way to: http://www.colorado.edu/geography/cartpro/cartography2/fall2011/bartel/projects/project3_tungurahua/tungurahua_hazards. html

The map is loaded in the iframe. I would like to switch between different kmls without changing the enlarged view as well, but I will post this question separately. I searched for the answers, but did not find anything special about this question: if I missed a message about this, I would be happy to check it if someone can point me in the right direction.

Here is 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); // set navigation controls ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO); // to fetch a KML file and show it function finished(object) { if (!object) { // wrap alerts in API callbacks and event handlers // in a setTimeout to prevent deadlock in some browsers setTimeout(function() { alert('Bad or null KML.'); }, 0); return; } ge.getFeatures().appendChild(object); var la = ge.createLookAt(''); la.set(-1.251336, -78.443817, 7000, ge.ALTITUDE_RELATIVE_TO_GROUND, 177, 65, 500); ge.getView().setAbstractView(la); } //var marker = new GMarker(new GLatLng(-1.402002,-78.409471)); // latitude, longitude // map.addOverlay(marker); function failureCB(errorCode) { } google.setOnLoadCallback(init); 

Thanks!!

+4
source share
1 answer

You can set the speed of flight to SPEED_TELEPORT before loading the abstract representation.

This setting will cause the globe to instantly fly to the right place, and not β€œrun over”. If regular moving should be restored, then after the initial scan, you can set the speed back to the default value.

For example, the following function can be used to instantly jump to the right place. The method accepts any KmlAbstractView , that is, KmlCamera or KmlLookAt as the only parameter.

 // fly-to a view using SPEED_TELEPORT function teleport(abstractView) { var oldSpeed = ge.getOptions().getFlyToSpeed(); . ge.getOptions().setFlyToSpeed(ge.SPEED_TELEPORT); ge.getView().setAbstractView(abstractView); // Wooosh! ge.getOptions().setFlyToSpeed(oldSpeed); } 

In addition to this, to ensure that the transition is not shown at all for the starting position, you can move the teleport before setting the GEWindow visibility to True. For instance.

 function initCB(instance) { ge = instance; var la = ge.createLookAt(''); la.set(-1.251336, -78.443817, 7000, ge.ALTITUDE_RELATIVE_TO_GROUND, 177, 65, 500); teleport(la); // set the position ge.getWindow().setVisibility(true); // now display the window //etc.. 
+2
source

Source: https://habr.com/ru/post/1445243/


All Articles