Code covered by the BSD License  

Highlights from
Heightprofile from GoogleEarth to 3D-Surface

  • ge_test1 This is an example script on how to get data (loacations with altitude, colored image) from GoogleEarth into
  • View all files

5.0

5.0 | 2 ratings Rate this file 52 Downloads (last 30 days) File Size: 1.86 MB File ID: #32357
image thumbnail

Heightprofile from GoogleEarth to 3D-Surface

by

 

27 Jul 2011 (Updated )

The tool get the height-Profile from GoogleEarth via COM-API and the image to generate a 3D-surface.

| Watch this File

File Information
Description

This is an example script on how to get data (loacations with altitude, colored image) from GoogleEarth into
a matlab surface.
Use this function as a script so comment the first line!

The code was tested with Matlab 2010a an GoogleEarth 6 (actual version) so download it or try your actual
GE-version: http://www.google.com/intl/en/earth/index.html

Further help for GoogleEarthAPI you find under:
http://web.archive.org/web/20090301030557/http://earth.google.com/comapi/index.html

You need additional MCFE-files before script will run without errors:
      http://www.mathworks.com/matlabcentral/fileexchange/5256-pos2dist
      http://www.mathworks.com/matlabcentral/fileexchange/28357-jmouseemu-mouse-emulator-v2-2
      http://www.mathworks.com/matlabcentral/fileexchange/28603
      http://www.mathworks.com/matlabcentral/fileexchange/14584-clipboardimage

 ATTENTION: There is a heavy workaround to get an colored image from GE in line 70 (jmouseemu). Here it is
 necessery to set the mousepointer in the actual GE-picture, so the x and y pixels must be in it! The
 problem is, that it will not work in debug mode.
 Depending of internetconnection speed you must play a little with the pause-times to get all needed data.

Programmed by Sven Koerner: koerner(underline)sven(add)gmx.de
Date: 2011/07/27

Acknowledgements

Pos2dist, Clipboardimage, J Mouse Emu: Mouse Emulator (V2.3), and Input Emu: Keyboard & Mouse Emulator (V1.0.1) inspired this file.

MATLAB release MATLAB 7.10 (R2010a)
Other requirements GoogleEarth: http://www.google.com/intl/en/earth/index.html
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (16)
29 May 2012 Sven Koerner

Hi Pål,
I guess that is a limitation from google. I also tried to request a lot of values, however after a short time the anwser will last longer. So if you like to request more value, try to build in the pause-function of matlab, where you wait a second or two between the requested values. Normally it is not neccessary to reopen GE.
Otherwise you cqan try reopen GE from within Matlab:
ge_app.Quit;
ge_app.delete;

25 May 2012 Pål

Hi Sven,

I am having a problem when trying to loop the code over several locations without manually closing GE in between and when increasing the spatial resolution of the "meshgrid" (to f.ex. meshgrid(-1:(1/100):1, -1:(1/100):1). I'm not running the "get colored image" part of the code as I only need the X Y Z coordinates. For the first approx. 10 000 altitude values everything is quick and nice (0.001 s. pr fetched value), but after that it slows down to about 1.1 s. per fetched value. Clearing all Matlab variables dont help.

Have you experienced this kind of problems or have any suggestions for solutions? Could it be an alternative to close GE from within Matlab? If so, have you got any idea how to do this?

08 May 2012 Zeneida

Thanks Sven

Thats the information that I nedeed.

Regards
Zeneida

08 May 2012 Sven Koerner

Hey Zeneida,

here is the API-Documentation:
http://web.archive.org/web/20090227094449/http://earth.google.com/comapi/interfaceIApplicationGE.html#9e1c8da5b36e8687fe718f2267224103

In SetCameraParams means the 6 the speed of changing the view, where 6 is teleport.

The azimuth reference is here:
http://web.archive.org/web/20090301151734/http://earth.google.com/comapi/interfaceICameraInfoGE.html

Regards
Sven

08 May 2012 Zeneida

@Sven Körner: Thanks, I've other question, the azimut value should be changed?? and what represent the number 6 in this line: camPos.FocusPointAltitudeMode, camPos.Range,
camPos.Tilt, camPos.Azimuth, 6)??

08 May 2012 Sven Koerner

Hi Zeneida,

go to your GE-Application and run it. Zoom to your region and modify the parameter for latidude and longitude as shown in the GE-Picture in the middle at the bottom in decimalgrad:
e.g. for Ecuador:

camPos.FocusPointLatitude = -1.831239;
camPos.FocusPointLongitude = -78.183406;

Regards
Sven

08 May 2012 Zeneida

@Sven Körner: I was reviewing the scrip, now I understood first lines, I just have doubt with the Azimut, I not sure abourt this value, and I want to know what means the number six at the end of the following line:

camPos.FocusPointAltitudeMode, camPos.Range,
camPos.Tilt, camPos.Azimuth, 6);

Thanks

07 May 2012 Zeneida

Hi Sven,
Is the first time that I'll use your script.Could you explain me the following lines, in order to I can use this in my region (Ecuador). What are the data that I should put here.

% teleport to location
camPos.FocusPointLatitude = 51.10719595658241;
camPos.FocusPointLongitude = 13.638689585783112;
camPos.FocusPointAltitude = 0.0;
camPos.FocusPointAltitudeMode = 'AbsoluteAltitudeGE';
camPos.Range = 11780.53549488341;
camPos.Tilt = 0;
camPos.Azimuth = 7; % 0 < Speed <5 --> Speed> 5: Teleport
ge_app.SetCameraParams(camPos.FocusPointLatitude, camPos.FocusPointLongitude, camPos.FocusPointAltitude, camPos.FocusPointAltitudeMode, camPos.Range,

camPos.Tilt, camPos.Azimuth, 6);

Thanks

10 Mar 2012 Matt

Hi Sven,

Thanks for your help. Now I know how to use your code now.

I need to run the code 2 times. The first time is that I need to use ctrl+alt+c and ctrl+shift+c to copy the map. (the first time will display a error on matlab window). After I run the code again, it is works.

04 Mar 2012 Matt

@Sven Körner:Yea, same problem...waiting for fix it .......many thanks.....

27 Feb 2012 Roberta

@gong I have the same problem... my computer just accept keycombination "Ctrl+Alt+C".. I changed the command.. but it didnt work as well.. Did u try anything else??

18 Aug 2011 GONG

@Sven Körner:Thank you for so patient. In my GE,I must press the keycombination "Ctrl+Alt+C" to take a snaphot of colored GE-image. The keycombination "Alt+C" doesn't work.

05 Aug 2011 Sven Koerner

@GONG. When you run GoogleEarth normally - can you take a snaphot of colored GE-image with keycombination "ALT-C"? (Open GE, go anywhere, then press "ALT-C", then open a paint-program (e.g.) irfanview abd press crtl-V. Is there the image inside?

04 Aug 2011 GONG

@Sven Körner: Thank you very much! But it could not solve the problem. The imdata is empty with char type. The problem is the same as before while I set the pause in line 74.

04 Aug 2011 Sven Koerner

@GONG: set breakpoint in line 78. What is the type of imdata in Matlab-Workspace? If imdata is empty then modify the position of mousepointer in jmouseemu (line 72) and/ or set the pause in line 74 a littlbe bit longer. The given position must be anywhere in the google-earth picture on your monitor.

03 Aug 2011 GONG

??? Error using ==> cq
First input must be a uint8 array.

Error in ==> rgb2ind at 91
[map,X] = cq(RGB,m);

Error in ==> ge_test1 at 78
[X2, map2] = rgb2ind(imdata, 256); % not more than 256 because of uint8 is necessary

Updates
05 Aug 2011

added help pdf

07 Nov 2011

new title

08 May 2012

Changed the link to the GoogleEarthAPI.

Contact us