Simple Encodings for the GeoWeb
The power of the web comes from many people using a common means of encoding their information within a common framework for referencing and exchanging this information. This is an extermely active area of technology at the moment that will continue to change the ways that human beings understand their environment for many years to come. As advanced as it all seems right now, we are at the very beginning! As complex as it seems, the web is really based on some very simple specifications for encoding and referencing information, and this simplicity is at the root of the massive explosion of linked-up information that we enjoy. At the heart of this is the development of a generic way of organizing information, known as Extrensible Markup Language, which is simply a way of adding a hierarchal structure to a plain text document using tags. These tags mark the text that they enclose as having a specific meaning. Communities of interest can define the information that they need to encode and sechange as Document Type Definitions that inform the people (and the computers) involved how to validate and make sense of an XML document. When communities develop open specifications for systematic encodings for knowledge, and these specifications are governed by non-profit standards consortia, it gives people a vehicle for building information infrastructure with some security that their work will not become obsolete due to actions of competitive commercial companies.
Download the Sample Data
Hypertext Markup Language (HTML) is an example of an XML Document Type. Keyhole Markup Lnguage (KML) is another. ALlthough there are authoring tools that allow you to develop information in HTML and KML with a certain amount of detachment from the code itself, thae are many occaisions when it is useful to understand how the tag work so that you can add elements that may not be possible to add with our graphical tools. It is also the case, that our tools or other things that we do may cause problems that we can fix easily if we know how to open up a file and make edits. A couple of examples that we will encounter in our GeoWeb work include the formatting of HTML in the Description Elements of our Google Earth files, and adding temporal references to KML files.
Getting Started With HTML
We use HTML editing tools all the time. There are several What You See is What You Get editing tols out there that you can use to format text and add images, etc. One example is the XINHA Editor. This editor will let you format text and include hyperlinks to other pages and add images. THen you can look at the HTML that lies behind it all. These editors will also let you type HTML and then view how it will render in a web browser. If you want to learn more about the tags of HTML and what they do, you can look at the Official HTML Reference from the World Wide Web Consortium, or you may prefer this friendlier HTML Tutorial from the w3 Schools.
HTML in Google Earth Bubble Text
One important application that calls for us to write HTML directly is for formatting the descriptive text in our KML documents. In this example, we will open up the KML for our photograph of Scollay Square and add a link to the image itself, and some formatted text and a hyperlink to the page where we found the resource. There are just a few tags we have to learn, and we will also learn about references to files, which can either be Local References to files that are stored in the filesystem withthe KML itself. We will also learn about Uniform Resource Locators that specify files that are shared by web servers.
THe basic tags we will learn include the Paragraph Bold, Anchor and the Image tags.
Format your KML Description using HTML Fomratting
- Use Google Earth to open the KML file for our photograph of Scollay Square from the tutorial data.
- Notice the formatted description. Nice, eh?
- Now examine the HTML formatting of this description
- Experiment with the bold tag to make some of the text bold.
- Make some links
- Resize the image.
Getting Comfortable with KML
Now there are some things that you may want to do in KML that are impossible to do in Google Earth. For one example, if you don;t like the little camera icon that Google Earth uses for photos you can change it to a small version of the photograph itself, but Google Earth does not have a way of doing this. But if you are good with KML its no problem! The first ting we will do is look at the KML reference for photos. From here, we will see how the KML specifies what image to use for this style icon. Then we will use photoshop or any image editing tool to create a small icon image for the photo and then reference this with our KML File.
Most KML Files contain several elements and each element has a number of sub elements. IN the case of our image overlay, there are two images that are of interest. One of them is the photograph itself, another is the little image that is used for the icon that shows us where the image is referenced on the earth, and another povides the image that is used in the Places Panel. The refernce to the big image is stored in the Icon tag of the
Editing KML can be tricky at first so you will want to make copies of your KML documents before you open them and start editing. You also will want to turn off line wrapping in your text editor so that you don't get confused.
Hacking Your Camera Icon
- Make a opy of our KML file for the historic photograph
- Open this in WordPad
- IN the view settings for wordpad, turn off wrapping.
- Find the reference for the photograph. Notice thaqt it is using a local reference that understands that the KML file is in the same folder as the image itself.
- Find the reference to the photo_icon image. You can take a look at this uing windows explorer.
- Replace this image with another icon image of your choosing.
- Save this KML file replacing the orifinal one. YOu know you have a copy in case there was a problem.
- Preview the file in google earth
- Go to the Index for the PaulCote folder where we saved network links to our files. Open this index.
- Notice that the network link index reflects the changes we made to the resource!
The TimeSpan Element
Now you are ready for the good part: Hacking the TimeSpan Element!!
- Create a new folder in Temporary Places Name this folder Building
- WIthin it create a polygon for your old building and name it Old Building and adjust its height.
- Make a copy of your old building, and adjust its properties to change its name to New Building. Adjust its height so that is significantly higher or lower than the old one.
- Now, you can look around for a place to enter the timespan. Note that while a TimeSpan mayt be added in the View properties for an object, this affects the sun angle but not the actual appearance of the building.
- According to the KML refgerence, the TimeSpan element needs to be within
- Just for reference, you can go to my sample One Union Square folder and right-click and choose Copy
- Now open WordPad or your favorite text editor. And choose Paste There is the KML!
- Note how in my sample, there is a block of text that falls between the opening tag for
, just after the closing tag for </description> and the opening tag for the <lookat> element. It reads:
<gx:TimeSpan> <begin>1870-01-01</begin> <end>1945-01-01</end> </gx:TimeSpan>
- If you want to , you can select and copy this text.
- Now select your Building folder in tGoogle Earth and Copy it into a new wordpad file.
- Paste the timespan element in to the proper place for each building and update the timespan,
- Use Save As to save your modified KML to a Plane Text dovument with a KML suffix.
- Open it in Google Earth and examine how it works with the timeslider. YOu may eget errors when you open the file, if you have not been careful to paste your timespan tags into an apropriate place. Of course all XML files are very sensitive to having all of the oening and closing tabs in the proper relationships.
- Viola! you have used your understanding of KML to do something very useful that you cannot do with the Google Earth 5.1 interface!