Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Google-Earth
Hi all,
I'm developing a software using Google Earth API COM (EARTHLib).
I need to get the altitude for user specified points so I used this code:
 
 
        private void button7_Click(object sender, EventArgs e)
        {
           ge = new ApplicationGEClass();
            PointOnTerrainGE pot = ge.GetPointOnTerrainFromScreenCoords(0, 0);
            lblAlt.Text = pot.Altitude.ToString();
 
        }
 
 
The problem is that this code gives the altitude just for the center of the viewer screen.
I tried this to make a second point and replace (0,0) with a lat and long for the first point as arguments
 
 
private void button7_Click(object sender, EventArgs e)
        {
           ge = new ApplicationGEClass();
            PointOnTerrainGE pot = ge.GetPointOnTerrainFromScreenCoords(0, 0);
            PointOnTerrainGE pot2 = ge.GetPointOnTerrainFromScreenCoords(pot.Latitude, pot.Longitude);
            lblAlt.Text = pot2.Altitude.ToString();
 
        }
 

and since (0,0) represent just the viewer coordinates (not real coordinates) that doesn't solve the problem.
 
so there are two way to do it and here I need your help, the first solution is to place like a plus mark (+) in the center of the viewer to let the user know what point the altitude is given for, and the next solution is to replace (0,0) with real coordinates...
 

any one could help me with this please?
Posted 17-Dec-12 21:09pm
M.S.S.E400
Edited 17-Dec-12 23:59pm
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 480
1 Bhavik_Patel 190
2 Richard MacCutchan 155
3 PhilLenoir 155
4 Gihan Liyanage 155
0 Sergey Alexandrovich Kryukov 8,688
1 OriginalGriff 7,237
2 CPallini 2,598
3 Richard MacCutchan 2,080
4 Abhinav S 1,888


Advertise | Privacy | Mobile
Web04 | 2.8.140827.1 | Last Updated 18 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100