Google Earth, KML, and Google Map
Total Page:16
File Type:pdf, Size:1020Kb
GEOG677 – Internet GIS University of Maryland at College Park Lab Assignment 2 – Web Mapping with Google Earth, KML, and Google Map Due Date: 01/05/2012 Overview This lab assignment is designed to help you explore the potential of Web mapping with some of the most popular tools (e.g. Google Earth, KML, and Google Map). The results will be published on your website and made available to anyone through the Internet. This assignment is divided into five parts: Part I: Google Earth Part II: KML Part III: Using Google Earth to create KML Part IV: Using ArcGIS to create KML Part V: Creating Customized Web Mapping with Google Map Data The GIS data to be used are as following (downloadable on the Blackboard): PG_Hospitals.shp PG_CensusTracts.shp Part I: Google Earth This section will help you get a better understanding about Google Earth and its capabilities. You will also need to install it on your computer in order to complete the tasks in later sections. 1. Getting to Know Google Earth Google Earth is a virtual globe, map and geographic information program that has been developed and trademarked by Google, Inc. It is probably one of the most exciting and popular software in past few years. Google Earth is an interactive mapping application that allows users to navigate the entire globe, viewing satellite imagery with overlays of roads, buildings, geographic features, and so on. It displays satellite images of varying resolution of the Earth's surface, allowing users to visually see things like cities and houses from a bird's eye view. The degree of resolution available is based somewhat on the points of interest and popularity, but most land (except for some islands) is covered in at least 15 meters of resolution. Due to its nature, Google Earth is closely related to other geo-spatial technologies such as GIS and GPS. It can show all kinds of images overlaid on the surface of the earth and is also a Web Map Service client. Some people will go as far as claiming Google Earth is “People’s GIS” because of its popularity and free-to-use (almost). That’s why it is important to know some of the applications of Google Earth, especially when it comes to Web mapping. 1 GEOG677 – Internet GIS University of Maryland at College Park 2. Downloading and Installing Google Earth Google Earth is available under three different licenses: Google Earth, a free version with limited functionality Google Earth Pro ($399 per year), which is intended for commercial use. Google Earth Enterprise For this class, it is perfectly fine to use the free version. Your first task is to go to here and download Google Earth (V6): http://earth.google.com/ When installing, you can just follow the instructions on those pop-up windows. There is one step that will ask you to select setup type, make sure you check “Complete”. 3. Practicing Google Earth Even though Google Earth provides state-of-art user interface, it still can be overwhelming to use it because there are so many buttons, menus, and options. Therefore, you may want to spend some time to read the User Guide (below) and do some testing. http://support.google.com/earth/bin/static.py?hl=en&page=guide_toc.cs Part II: KML KML refers to Keyhole Markup Language, which is a file format used to display geographic data in an Earth browser such as Google Earth, Google Maps, and Google Maps for mobile. KML uses a tag-based structure with nested elements and attributes and is based on the XML standard. All tags are case-sensitive and must be appear exactly as they are listed in the KML Reference. 1. Getting to Know KML KML was developed for use with Google Earth. However, it can be displayed by many other applications including: Google Maps, Google Maps for mobile, NASA WorldWind, ESRI ArcGIS Explorer, Adobe PhotoShop, AutoCAD, Yahoo! Pipes, and so on. If you are not familiar with KML, before you start next session, you might want to check out this KML tutorial: http://code.google.com/apis/kml/documentation/kml_tut.html Also, you can even test some KML samples by using Google Earth which you have installed. The samples can be found here: http://code.google.com/apis/kml/documentation/KML_Samples.kml 2 GEOG677 – Internet GIS University of Maryland at College Park 2. Creating KML There are many different ways of creating KML files. Obviously, you can simply write KML codes just like HTML. And, you can also create KML files with Google Earth. In addition, you can create KML using some software such as ArcGIS. These last two options are the simplest way of creating KML because you don’t need to deal with coding. However, you may pay a price of not being able to control what exactly you want to do. Now let’s try the first option. The typical file structure of KML is as below: <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Placemark> <name>New York City</name> <description>New York City</description> <Point> <coordinates>-74.006393,40.714172,0</coordinates> </Point> </Placemark> </kml> The structure of this file breaks down as follows: An XML header. This is line 1 in every KML file. No spaces or other characters can appear before this line. A KML namespace declaration. This is line 2 in every KML 2.2 file. A Placemark object that contains the following elements: o A name that is used as the label for the Placemark o A description that appears in the "balloon" attached to the Placemark o A Point that specifies the position of the Placemark on the Earth's surface (longitude, latitude, and optional altitude) We can use the similar way of creating HTML to create KML. Now, open NotePad and copy/paste those codes on previous page and then save it as a “.kml” file. Make sure the file extension must be “.kml” and the file name should contain your user ID. I would suggest that you create a path – “Lab2/KMLs/” and save the file there. Other KML files will be saved there, too. 3 GEOG677 – Internet GIS University of Maryland at College Park After you save this file, you can double-click it to open. Google Earth should be automatically opened and the placemark (i.e. New York City in this case) will be displayed at the center of the map. Now, you can change the placemark to some place which is more relevant to yourselves, for example, your home address or your favorite restaurant, etc. To do so, you will have to know the precise coordinates (latitude and longitude) of that location. There are a variety of ways of getting the coordinate. In this case, why don’t we let Google Earth do the work? Here is an example: Let’s say I want to create a placemark for my favorite restaurant in College Park. The restaurant is Applebees and its address is: 7242 Baltimore Ave, College Park. First, I would open Google Earth. I will then type in the address in the Search bar and hit Enter. The globe will move and eventually display this point at the center of the map (see image below). 4 GEOG677 – Internet GIS University of Maryland at College Park Now, right-click the search result and select Properties. Now, you can see the coordinates (see image on next page). Write them down and then replace the coordinates in the KML file you created earlier. Make sure the latitude and longitude match. Also, don’t forget the “-” sign in front of longitude. Notice that the coordinates are in DMS (degree-minute-second) format. You will need to convert them into DD (decimal degree) format. 5 GEOG677 – Internet GIS University of Maryland at College Park Also, modify the “Description” in the KML file accordingly. In the end, you KML should look like the one below. Make sure your user ID is part of the file name. After I saved the KML file, I double-click to open it. The result is shown as below. 6 GEOG677 – Internet GIS University of Maryland at College Park Better yet, you can share your KML files in a variety of ways: you can e-mail them, host them locally for sharing, or host them publicly on a Web server. In this case, we are going to use the Web. Once you've properly configured your server and shared the URL (address) of your KML files, anyone who's installed Google Earth can view the KML files hosted on your public web server. For example, I have posted the KML I created on my website: http://www.terpconnect.umd.edu/~jma3/GEOG677/Lab2/ Or, you can refer to this example from last year: http://terpconnect.umd.edu/~dbarker7/html/maryland_gis_-_kml_experiments.html Your task: You are required to modify the KML file that you created earlier by: (1) first selecting a location that you like; (2) obtain/convert the coordinates; (3) re-write the part of codes for Name/Description and coordinates within the KML file. Lastly, you will upload the KML file to the server and then create a link to it on one of your web pages. 7 GEOG677 – Internet GIS University of Maryland at College Park Part III: Using Google Earth to Create KML You can also create Google Earth to create KML. This is actually easier because it does not involve coding. Let’s assume that I want to create an application that can help some people find and get to know some of the most popular landmarks in DC area.