GOOGLE EARTH C#

in #utopian-io7 years ago (edited)

In this article, Microsoft Visual Studio programme will learn how to add us the google earth add-on and assume control. This programme is the intended position provides us to find by courtesy of entered latitude and longitude information.The application be able to do need some libraries and plunging add-on.

What Will I Learn?

  • Microsoft Visual Studio
  • Adding Google Earth app

Requirements

  • Microsoft Visual Studio
  • Interop.GEPlugin.dll
  • GoogleEarthPluginSetup.exe

Difficulty

  • Intermediate

Tutorial Contents

What is Google Earth?

Google Earth is a geobrowser that accesses satellite and aerial imagery, ocean bathymetry, and other geographic data over the internet to represent the Earth as a three-dimensional globe. Geobrowsers are alternatively known as virtual globes or Earth browsers.

What is Microsoft Visual Studio?

Visual Studio 2017 is an integrated, complete solution with development tools, cloud services and extensions that enables you and your team to create great applications and games for desktops, the web, Windows Store, Android and iOS. Choose between different editions, depending on whether you work alone or in a small team (Professional edition) or in a complex project across departments and locations (Enterprise edition). Visual Studio 2017 provides everything you need to help you deliver software in less time and even better quality.

Preparing to Add Google Earth to Your Microsoft Visual Studio Program.

We are downloading the extension Interop.GEPlugin.dll from my computer.

We click on Browse and choose Interop.GEPlugin.dll from our computer.

Running the program in our computer.

To run this application on our computer, we need to download GoogleEarthPluginSetup.exe and install it on our computer.

Program Codes.

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using GEPlugin;
namespace WindowsFormsApplication1
{
    [ComVisibleAttribute(true)]    
    public partial class GOOGLEEARTH : Form
    {
        public const string EARTHADRES = @"http://earth-api-samples.googlecode.com/svn/trunk/demos/desktop-embedded/pluginhost.html";
        public IGEPlugin EARTHKONTROL = null; //Google Earth apisini kullanmak için gerekli değişken, bu değişken üstünden yönlendiriyoruz apiyi.      
        public KmlLookAtCoClass lookAt;
        KmlScreenOverlayCoClass hedef_isareti;
        public GOOGLEEARTH()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
            //projeyi Debug yaptığımız anda harita açılacak.
        {
            internet_tarayicisi.Navigate(EARTHADRES);//EARTHADRES'deki linki internet tarayıcısı nesnesinin içerisinde açacağız.
            internet_tarayicisi.ObjectForScripting = this;
        }
        public void JSInitSuccessCallback_(object pluginInstance)
        {
            EARTHKONTROL = (IGEPlugin)pluginInstance;
        }
        public void Konum_Bul(double x, double y, double z)
        {
            KmlLookAtCoClass lookAt = EARTHKONTROL.getView().copyAsLookAt(EARTHKONTROL.ALTITUDE_RELATIVE_TO_GROUND);
            lookAt.setLatitude(x);  //enlem
            lookAt.setLongitude(y); //boylam
            lookAt.setRange(z);     //yükseklik           
            EARTHKONTROL.getView().setAbstractView(lookAt);
        }   
        private void konuma_git_Click(object sender, EventArgs e)
        {          
            //Koordinatlar Karabük üniversitesi mühendislik fakültesine aittir.(41,206428, 32,659381, 1000)
            //Enlem ve boylamı dereceden ondalığa çevirmek lazım.           
            Konum_Bul(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text), Convert.ToDouble(textBox3.Text));
            //Koordinatlar nokta, double sayı küsuratı virgül olduğundan yukarıdaki gibi           
        }       
        private void timer1_Tick(object sender, EventArgs e)
            //Bu timer harita üzerinde gezinirken olduğumuz konumun enlem, boylam ve yükseklik bilgilerini bize veriyor
        {
            try
            {
                KmlLookAtCoClass lookAt = EARTHKONTROL.getView().copyAsLookAt(EARTHKONTROL.ALTITUDE_RELATIVE_TO_GROUND);
                label5.Text = Convert.ToString(lookAt.getLatitude());  //enlem bilgileri
                label6.Text = Convert.ToString(lookAt.getLongitude()); //boylam bilgileri
                label7.Text = Convert.ToString(lookAt.getRange());     //yükseklik bilgileri
            }
            catch
            {
            }
        }
        private void donusturucu_Click(object sender, EventArgs e)
        //Konum bilgilerinden dakika ve saniyeyi dereceye çevirerek ondalık hale çevirmeye yarayan hesaplama işlemi
        {
            //Küsuratlı sayıları virgüllü yazmalıyız!!! Program bu şekilde çalışmaktadır.
            double saniye_e1 = Convert.ToDouble(textBox7.Text);//enlem bilgisinin saniye kısmı
            double dakika_e1 = Convert.ToDouble(textBox8.Text);//enlem bilgisinin dakika kısmı
            double derece_e1 = Convert.ToDouble(textBox9.Text);//enlem bilgisinin derece kısmı
            double saniye_b1 = Convert.ToDouble(textBox6.Text);//boylam bilgisinin saniye kısmı
            double dakika_b1 = Convert.ToDouble(textBox5.Text);//boylam bilgisinin dakika kısmı
            double derece_b1 = Convert.ToDouble(textBox4.Text);//boylam bilgisinin derece kısmı
            double a = dakika_e1 + (saniye_e1 / 60);
            double b = derece_e1 + (a / 60);
            textBox1.Text = b.ToString();//ondalığa çevrilmiş enlemi textbox'a yazdırma
            double c = dakika_b1 + (saniye_b1 / 60);
            double d = derece_b1 + (c / 60);
            textBox2.Text = d.ToString();//ondalığa çevrilmiş boylamı textbox'a yazdırma
        }

        private void hedefisareti_ac_CheckedChanged(object sender, EventArgs e)
        {
            hedef_isareti = EARTHKONTROL.createScreenOverlay("");
            hedef_isareti.setIcon(EARTHKONTROL.createIcon(""));
            hedef_isareti.getIcon().setHref("http://www.notsitesi.com/model/isaret.png");
            EARTHKONTROL.getFeatures().appendChild(hedef_isareti);
        }
      
    }
}

http://www.imgim.com/3073incik4183219.png

When the go to toggle button is pressed, it goes to the position where the latitude, longitude and altitude values in the textboxes are.

In the Google Earth program, we view the latitude and longitude information of Karabuk University Rectorate in degrees, minutes and seconds.

We checked the correctness of the translation from degree to decimal.

With this program, we can access latitude and longitude information on satellite images wherever we want.This program can be improved a lot and different programs can be developed.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Congratulations @mehmetyil! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

I am the owner of this resource. I shared it so that the users of Steemit would benefit.

Your contribution cannot be approved because it does not follow the Utopian Rules, and is considered as plagiarism. Plagiarism is not allowed on Utopian, and posts that engage in plagiarism will be flagged and hidden forever.

Plagiarized source: http://www.ibrahimcayiroglu.com/Dokumanlar/MekatronikProjeUygulamasi/6-Makale-Google_Earth_Uzerinden_Navigasyon_Uygulamasi-Mehmet_YILDEMIR.pdf

You can contact us on Discord.
[utopian-moderator]

I am the owner of this resource. I shared it so that the users of Steemit would benefit.

I am reviewing your post again since I didn't realized that you are the author at first. The decision on the contribution stays as is, because contribution on C/C++/C# are not approved since there is no proper repository for this languages, and repositories belong to IDEs are not approved for the contributions on those languages. And I should also say that this contribution is not as informative as we expect tutorials to be. Contributions in the category are supposed to contain detailed instructions and explanations for topics covered in the post. Take this as a suggestion for your future contributions.

Thank you for the advice.