Click here to Skip to main content
12,448,343 members (51,584 online)
Rate this:
 
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.E401
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160811.3 | Last Updated 18 Dec 2012
Copyright © CodeProject, 1999-2016
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