Click here to Skip to main content
15,069,297 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:

C#
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

C#
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
Updated 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)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900