Click here to Skip to main content
Click here to Skip to main content

Google Earth Network Link

, 27 Dec 2007 CPOL
Rate this:
Please Sign up or sign in to vote.
This article aims to show the creation of Network Links for Google Earth.

Screenshot - earth

Introduction

This article aims to show the creation of Network Links for Google Earth.

The Code Source

Create a new ASP.NET Web application and upon Page_Load, copy and paste this code, or download the source code.

Grid Creation: Creating the Constructor for the Grid

Imports System.Xml
Partial Public Class _Default
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object,
            ByVal e As System.EventArgs) Handles Me.Load
        Me.Response.Clear()
        Me.Response.ContentType = "application/vnd.google-earth.kml+xml"
        'Para ver o documento XML
        'For view XML document
        'My.Response.ContentType = "plain/text"
        Me.Response.ContentEncoding = System.Text.Encoding.UTF8
        Dim stream As New System.IO.MemoryStream
        Dim XMLwrite As New XmlTextWriter(stream, System.Text.Encoding.UTF8)
        XMLwrite.WriteStartDocument()
        XMLwrite.WriteWhitespace(Environment.NewLine)
        XMLwrite.WriteStartElement("kml")
        XMLwrite.WriteAttributeString("xmlns",
           "http://earth.google.com/kml/2.0")
        XMLwrite.WriteWhitespace(Environment.NewLine)
        '<Document>
        XMLwrite.WriteStartElement("Document")
        XMLwrite.WriteWhitespace(Environment.NewLine)
        XMLwrite.WriteElementString("name", "Signal Control")
        XMLwrite.WriteWhitespace(Environment.NewLine)
        '<Placemark>
        XMLwrite.WriteStartElement("Placemark")
        XMLwrite.WriteWhitespace(Environment.NewLine)
        XMLwrite.WriteElementString("description", "MY DESCRIPTION/MINHA DESCRIÇÃO")
        XMLwrite.WriteElementString("name", "MY NAME/MEU NOME")
        XMLwrite.WriteStartElement("LookAt")
        XMLwrite.WriteElementString("longitude", "MY LONGITUDE/MINHA LONGITUDE")
        XMLwrite.WriteWhitespace(Environment.NewLine)
        XMLwrite.WriteElementString("latitude", "MY LATITUDE/MINHA LATITUDE")
        XMLwrite.WriteWhitespace(Environment.NewLine)
        XMLwrite.WriteEndElement()
        XMLwrite.WriteWhitespace(Environment.NewLine)
        XMLwrite.WriteElementString("visibility", "1")
        XMLwrite.WriteWhitespace(Environment.NewLine)
        '<Style>
        XMLwrite.WriteStartElement("Style")
        XMLwrite.WriteWhitespace(Environment.NewLine)
        '<IconStyle>
        XMLwrite.WriteStartElement("IconStyle")
        XMLwrite.WriteWhitespace(Environment.NewLine)
        '<Icon>
        XMLwrite.WriteStartElement("Icon")
        XMLwrite.WriteWhitespace(Environment.NewLine)
        'Meu ícone, mudar este diretório
        'My Icon, change this directory
        XMLwrite.WriteElementString("href", "C:\Code_Project\01.ico")
        XMLwrite.WriteWhitespace(Environment.NewLine)
        XMLwrite.WriteElementString("w", "-1")
        XMLwrite.WriteWhitespace(Environment.NewLine)
        XMLwrite.WriteElementString("h", "-1")
        XMLwrite.WriteWhitespace(Environment.NewLine)
        XMLwrite.WriteEndElement()
        '</Icon>
        XMLwrite.WriteWhitespace(Environment.NewLine)
        XMLwrite.WriteEndElement()
        '</IconStyle>
        XMLwrite.WriteWhitespace(Environment.NewLine)
        XMLwrite.WriteEndElement()
        '</Style>
        '<Point>
        XMLwrite.WriteStartElement("Point")
        XMLwrite.WriteWhitespace(Environment.NewLine)
        'Minhas coordenadas, mudar aqui
        'My Coordinates, change aqui
        XMLwrite.WriteElementString("coordinates", 
            "-25.4942072754", "-49.5426559491",
            "50")
        XMLwrite.WriteWhitespace(Environment.NewLine)
        XMLwrite.WriteEndElement()
        XMLwrite.WriteEndElement()
        '</Point>'Fim do XML
        'Finish XML
        XMLwrite.WriteEndDocument()
        XMLwrite.Flush()
        Dim reader As IO.StreamReader
        stream.Position = 0
        reader = New IO.StreamReader(stream)
        Dim bytes() As Byte = System.Text.Encoding.UTF8.GetBytes(reader.ReadToEnd())
        Me.Response.BinaryWrite(bytes)
        Me.Response.End()
    End Sub
End Class 

Points of Interest

Go to places on Google Earth and click Add Network Link.

Screenshot - image002.jpg

Screenshot - image003.jpg

After compiling the project, this icon will arise:

Screenshot - image004.jpg

My link is created:

Screenshot - image005.jpg

License

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

Share

About the Author

robertosari
Systems Engineer
Italy Italy
No Biography provided

Comments and Discussions

 
QuestionWhat is GE? PinprofessionalRavi.Kumar0212-May-13 21:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141223.1 | Last Updated 28 Dec 2007
Article Copyright 2007 by robertosari
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid