Search code examples
javascriptkmlgoogle-earth

Google Earth Capture KML of current globe view


Does anyone know anyway to use something similar to polygon.getKml() except for the current LookAt or Camera containing all of the elements inside of the Earth View?

I have tried something along the lines of ge.getView().getKml() but getKml can only be applied to certain objects.

Also you can get each of the elements KML individually using a loop and:

ge.getFeatures().getChildNodes().item(#).getKml();

however this will not give you the lookat or the camera.


Solution

  • You can use either

    var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
    

    or

    var camera = ge.getView().copyAsCamera(ge.ALTITUDE_RELATIVE_TO_GROUND);
    

    see this page for documentation https://developers.google.com/earth/documentation/camera_control