<<

Improving the Visualization of Geospatial Data Using

Google’s KML

THESIS

Presented in Partial Fulfillment of the Requirements for the Degree Master of Science in

the Graduate School of The Ohio State University

By

Ebenezer Attua Odoi Jr

Graduate Program in Geodetic Science and Surveying

The Ohio State University

2012

Master's Examination Committee:

Prof. Alan Saalfeld, Advisor

Prof. Ralph Von Frese, Committee Member

Copyright by

Ebenezer Attua Odoi Jr

2012

Abstract

The Geospatial community continues to search for effective tools that produce visualizations of the of the and its features. With the aid of geobrowsers like

Google and , geoscientists can now tell their ‘tales’ in ways that nonscientists can grasp and respond to in terms of awareness, policy formulation, application development and integration in ventures that usher human existence forward.

This thesis explores diverse visualization techniques using Google’s Keyhole Markup

Language (KML) that will benefit the viewing of geological data. In the process the thesis will show the potential of geobrowsers and KML as a unified programming language.

Though there has been a proliferation of digital viewers like geobrowsers being developed, thematic mapping capabilities, unfortunately, has been left out. The thesis will explore how KML can be used to achieve thematic mapping, though KML itself was not specifically designed for this application. Current possibilities for making proportional symbol maps, chart maps, choropleth maps and animated maps with KML will be presented. The innovation of the thesis is the conversion of a database table into a thematic map, using proportional symbols to represent the data. The visualization implementations developed in this research show that KML and geobrowsers offer great potential for thematic mapping, but there are significant issues that need to be resolved. ii

This thesis will open a wider to implement visualization that they prefer to see via using their own datasets.

iii

Dedication

This document is dedicated to my family.

iv

Acknowledgments

I would like to express my heartfelt thanks to my advisor, Professor Alan

Saalfeld., who provided encouragement, guidance and constructive discussion throughout my research. Despite his tight schedule, Professor Saalfeld offered close supervision and critical comments that have greatly helped me develop an understanding of the subject as well as draft my thesis. I would also like to show my gratitude to Professor Ralph Von

Frese for his participation as a committee member.

Undoubtedly, I owe my deepest gratitude to my parents who have helped and supported me while studying in the U.S. Special thanks to all my colleagues and members of the GIS Laboratory at the Ohio State University.

v

Vita

1996 - 1998 ...... High School, Okuapemman Sec, Ghana

2000 - 2004 ...... Bsc. Geodetic , KNUST Ghana

2008 - 2012 ...... Graduate Student, Department of Civil &

Environmental Eng. and Geodetic Science,

The Ohio State University

Fields of Study

Major Field: Geodetic Science and Surveying

Track: Geographic Information Systems (GIS)

vi

Table of Contents

Contents

Abstract ...... ii

Dedication ...... iv

Acknowledgments...... v

Vita ...... vi

Table of Contents ...... vii

List of Figures ...... ix

Chapter 1: Introduction ...... 1

1.1 Spatial Data Representation ...... 3

1.2 Thesis Layout ...... 5

1.3 Research Motivation and Proposed Method ...... 5

Chapter 2: KML Background, Geobrowsers and Related Work ...... 7

2.1 KML ...... 7

2.2 Developer Environments for KML ...... 9

2.3 Using Geobrowsers for Thematic Mapping ...... 12

vii

2.4 Related Work...... 14

Chapter 3: Data Description...... 17

3.1 Ohio Seis ...... 17

3.1 Ohio Seismic Data ...... 18

3.2 United Nations Dataset ...... 21

3.3 US Census, Population and Employment Dataset ...... 21

Chapter 4: KML Visualization and Thematic Mapping Techniques ...... 22

4.1 XML Data Display ...... 22

4.2 Auto Legend Implementation...... 23

4.3 Implementing Dynamic KML Polygon Extrusion ...... 24

4.4 Raw Data Processing ...... 27

4.5 Manipulating Camera Angle and Viewpoint ...... 29

4.6 Referencing KML-to-KML ...... 31

4.7 Hotspot Image Placement...... 33

Chapter 5: KML Web-based Thematic Mapping ...... 35

5.1 The Thematic Mapping Engine ...... 35

5.2 Web Interface Workflow ...... 38

5.3 Web Interface Showcase ...... 40

Chapter 6: Conclusion and Future Work ...... 43

viii

References ...... 48

Appendix: Links to Programming Codes and Data ...... 53

List of Figures

Figure 1: Dr. John Snow’s map ...... 4

Figure 2: KML hierarchy ...... 9

Figure 3: Geobrowser selection (2012)...... 13

Figure 4: Ohio Seis online 2D mapping interface ...... 18

Figure 5: Data Table ...... 20

Figure 6: Google API 2D Mapping with layers ...... 22

Figure 7: API implementation with XML data ...... 23

Figure 8: Legend overlay implementation ...... 24

Figure 9: Geometry for polygon extrusion implementation ...... 25

Figure 10: Dynamic polygon extrusion ...... 26

Figure 11: Extrusion and code snippet for implementation ...... 27

Figure 12: Creating KML code from Excel using HTML tags ...... 28

Figure 13: Ohio Seis ...... 28

Figure 14: Viewpoint axis in Google Earth ...... 29

Figure 15: Altering viewing camera orientation ...... 30

Figure 16: KML Code snippet with camera parameters passed ...... 31

Figure 17: KML-to-KML referencing ...... 32

Figure 18: Identifying edges of interest ...... 33 ix

Figure 19: Hotspot implementation ...... 34

Figure 20: The Thematic Mapping Engine ...... 36

Figure 21: The interface of the Thematic Mapper ...... 37

Figure 22: Holistic approach to interface development ...... 38

Figure 23: Workflow for Module management and KML processing ...... 38

Figure 24: used in web implementation ...... 39

Figure 25: Web interface developed ...... 40

Figure 26: Add Profile Screen ...... 40

Figure 27: KMZ Output put in queue as a module ...... 41

Figure 28: Choropleth KMZ output of selected counties in Ohio ...... 41

x

Chapter 1: Introduction

Geobrowsers are viewers that allow to spatially referenced data over the internet with the ability to display both 2 and 3 dimensional features. Many users of geobrowsers are drawn to them because of the initial fascination of zooming in from high-altitude to street-level (Sandvik, 2008). Other users are also drawn in with the view of the real world that geobrowsers provide via satellite images. Apparently geobrowsers have re-ignited the love of geographic realization and discovery amongst many. User generated content has fueled the growth of this powerful tool (Butler, 2006). KML, originally created in 2001 by a company called Keyhole as a data format for its Earth browser named Earth Viewer (Wernecke, 2009), is an XML (Extensible Markup

Language) data format which is used to display information in a geographic context.

XML was chosen as the base language because it is primarily used to transport and store data using a set of rules for encoding documents. Since KML was envisioned to store feature coordinates and parse them through an interface XML provided a strong backbone. One of the inherited XML features was data encoding that offered a human- readable and machine-readable format backed by open standards.

Just as web browsers read and display HTML (Hypertext Markup Language) files, geobrowsers, such as Google Earth read and display KML files. Using Application

Programming Interfaces (API), programmers can write scripts that generate interactive

1

mapping applications based on content from single or multiple sources over the internet.

3D virtual globes such as Google Earth use the 1Perspective Projection with a WGS84 datum to represent the earth. This projection is inherent in the human visual system

(Goodchild, 2008). Within the last decade, powerful tools for geographic visualization have become common. Google Earth, Google Maps, Yahoo! Maps and Microsoft Virtual

Earth are the most popular and free geobrowsers. Prior to the geobrowsers boom, map users used general-referenced maps that focused on features like roads, shorelines, lakes.

Desktop Geographic Information Systems (GIS) helped fuel the interest to create and view thematic maps easily.

Thematic maps show spatial patterns of a social or physical phenomenon, such as population density, life expectancy or change. The amount of data available electronically is increasing. A huge amount of geospatial information is available over the Internet, and displaying it is a common theme. Thematic mapping is a common capability in GIS, but surprisingly the geobrowsers have not focused much on this powerful geographic representation. There is a lot that can be done using KML for advanced 3D visualization. Visualization helps distinguish relevant from non-relevant information and assists in locating specific information of interest easily and efficiently.

Below is a list of features this thesis will accomplish:

. Introducing new visualization techniques.

1 http://support.google.com/earth/bin/answer.py?hl=en&answer=148110

2

. Creating a web interface for automatic KML visualization implementation from

spreadsheet uploads.

This thesis is the continuation of the work carried by Arrey (2010) and Sandvik (2008).

1.1 Spatial Data Representation

Harvey (1969) stated that, the “whole practice and philosophy of geography depends upon the development of a conceptual framework for handling the distribution of objects and events in space.” How can the various, diverse sets of collected data be represented on a map? The map has to be accurate and visually pleasing, as well as easy to understand. Datasets exist in tabular form: there are variables and values associated with those variables. Just by looking at a table, it is difficult to gauge the comparison and interpretation of the data. Charts are better: pie-charts, bar-charts, and graphs contain visual information of the data. The question is then, how to transfer this data to a map, which also contains geographic information? The tabular data has to be associated with a geographic location. Some of the solutions, on a paper map, include choropleth, graduated symbol, and contouring methods. However, this also leads back to a previous problem: comparison and interpretation of the data. In developing thematic maps, the interpretation by users of the maps should be considered (Bossler, 2010). Thematic maps demonstrate “the difference from place to place of one class of feature” (Robinson,

1982), and this is the topic or theme of the map. A famous example, and recognizable even today, of a thematic map is Snow’s 1854 cholera map of London (Figure 1),

3

showing the location of the victims in the vicinity of a public water source (Robinson,

1982). Dr. Snow’s approach to represent the spatial distribution of the data was far more effective than using tabular or chart forms.

The contaminated well on Broad Street

Figure 1: Dr. John Snow’s map1

4

1.2 Thesis Layout

This thesis is organized into six chapters. The first chapter is an introduction of this study including a history of KML and its potential for developing advanced visualizations for geobrowsers. A review of recent methods and related work are presented in Chapter 2. The third chapter gives the description of the data used. The fourth chapter discusses the implementation techniques for KML visualization and the fifth chapter outlines the web-based implementation.

A conclusion and recommended future work for further research are given in the final chapter of this thesis.

1.3 Research Motivation and Proposed Method

This thesis offers both a series of KML data viewing techniques and an application platform for building thematic mapping. A major obstacle with mastering

Google’s KML is that the learning resources are difficult to find. Consequently this thesis will serve a guide to achieving multifaceted approaches common to well established desktop mapping , and, propose methods that one can use to accomplish tasks and prepare raw datasets for KML creation.

As discussed in Section 1.1, analysis and interpretation of thematic data is challenging due to large volume of datasets and visualization problem.

We have the same problems as the founders of the famous video-sharing website,

Youtube.com. The founders “recalled the difficulty involved in finding and watching 5

videos online” (Hopkins, 2006). To accommodate diverse KML visualizations the web approach developed in this thesis will allow users and developers to create profiles that will support multiple thematic visualizations. The programming structure of the web interface is modular and allows extensibility. Visualization methods developed in the future can be incorporated in the by creating profiles. Each profile is associated with a series of programming algorithms to structure an input spreadsheet for output as a KML with the desired visualization.

6

Chapter 2: KML Background, Geobrowsers and Related Work

In this chapter, the review of literature is focused on understanding exactly what

KML is and reviewing existing work that has been carried out by others.

2.1 KML

KML, or '', is an XML grammar and file format for modeling and storing geographic features such as points, lines, images, polygons, and models for display in Google Earth, Google Maps and other applications2. KML is focused on the geographic display of features on a map or globe. The XML language also includes controls of the user’s navigation in the sense of where to go and where to look (Wilson

2008). However, thematic mapping or thematic are not mentioned in the 233 page OGC KML standard document (Wilson, 2008), suggesting KML is not targeted towards this kind of usage. KML is a standard defining elements for conveying geospatial data (Udell, 2009). Google gave KML to the open Geospatial Consortium in 2008. KML is now an open standard used by Google’s Geo Tools and major third party visualization toolsets. KML is quickly becoming a standard for visualization as there already exist over

1 billion KML files on the web (Askay, 2011).

2 http://earth.google.com/support/bin/static.py?hl=en&page=guide.cs&guide=22373& topic=23747&answer=148118

7

In common with other XML grammars, KML uses a tag-based structure with nested elements and attributes. A KML document is processed in a similar way that

HTML documents are processed by web browsers. The basic building blocks of the language are called elements, and a tag is the way an element is represented as KML code (Crowder, 2007).

KML documents and their related images and 3D objects (if any) may be compressed using ZIP encoding into KMZ files (Google, 2008a), hence the Z at the end.

This greatly reduces the file size and makes data transfer more efficient, overcoming one of the major criticisms of XML-based structures.

KML Version 2.2 has been adopted as an OGC3 implementation standard and is complementary to most of the key existing OGC standards including GML (Geography

Markup Language), WFS () and WMS ().

Currently, KML 2.2 utilizes geometry elements derived from GML 2.1.2, including line string, linear ring, and polygon. The OGC and Google have agreed that there can be additional harmonization of KML with GML (e.g. to use the same geometry representation) in the future (Wilson, 2008). In April 2008 KML 2.2 was officially set and simultaneously acknowledged by the OGC Standard as the Google Earth’s core file

3 The Open Geospatial Consortium is a non-profit, international, voluntary consensus standards organization. It is leading the development of standards for geospatial and location based services.

8

format. Figure 2 shows the KML hierarchy. This structure does not accommodate processing of data within a KML file.

Figure 2: KML hierarchy

2.2 Developer Environments for KML

There are many developer environments for creating KML files. The developer environments are grouped into editors, validators, and libraries, including the open source library PyKML. Notepad++ (used for this thesis), is a free source code editor and

Microsoft Windows Notepad replacement that supports several languages. Running in the

MS Windows environment, Notepad++ use is governed by the GNU Public License. The

GNU operating system is a complete free software system, upward-compatible with Unix.

9

GNU stands for “GNU's Not Unix”. 4 Based on the powerful editing component Scintilla, Notepad++ is written in C++ and uses pure Win32 API and STL, which ensures a higher execution speed and smaller program size. By optimizing as many routines as possible without losing user friendliness, Notepad++ is trying to reduce power consumption by the CPU (computer central processing unit).

Alternative Programming editors include:

I. Code Validator5

The purpose of the KML Validator is to assist KML data authors in producing the highest quality KML possible by highlighting where their KML files are invalid or where they could be improved. The KML Validator uses a test suite to validate KML files against the KML 2.2 specification. Once the validation is complete, the Validator presents a report that identifies all the issues discovered during the validation process.

These issues are grouped by level:

 Level 1 errors mean that the KML file is not valid.  Level 2 and Level 3 issues are recommendations for improving the quality and interoperability of the KML file.

The KML Validator does not store KML files, it only provides validation of files that are submitted. The KML Validator is an online service that can be used to validate KML files. KML files or KMZ archives can be submitted for validation through a web interface.

4 http://www.gnu.org/gnu/gnu-history.html

5 http://kmlvalidator.com/content/about.htm

10

The current KML Validator is configured to validate files up to 2 megabytes in size. Files larger than 2 megabytes, including KMZ archives containing KML files that are bigger than this size limit, will be rejected. Even if a KML file is not completely valid or of the highest quality and interoperability, it may still display correctly when viewed in an Earth browser. Many browsers are tolerant of certain types of errors and still display the content correctly even if it is not strictly valid.

II. Pykml

pyKML is a Python package for creating, parsing, manipulating, and validating KML, a language for encoding and annotating geographic data. pyKML is based on the lxml.objectify API which provides a Pythonic API for working with XML documents. pyKML adds additional functionality specific to the KML language, it can be used with

KML documents that follow the base OGC KML specification, the Google Extensions

Namespace, or a user-supplied extension to the base KML specification (defined by an

XML Schema document). pyKML is open source; packaged releases can be found on the

Python Package Index (PyPI). Developers can download the pyKML source code. 6

III. libkml

This is a library to parse, serialize and programmatically access a KML document object model (DOM). The main API is C++, and there are SWIG bindings to Python and

6 http://packages.python.org/pykml/

11

Java. Google regularly processes the millions of KML files crawled using this software to verify correctness of the KML published as Google Earth layers. Quite a number of groups within Google use libkml to parse, create and process KML. The libkml software is distributed under the New BSD license, with text found at the top of each file. This library has been compiled and tested on Windows XP, Mac OS X 10.4 and 10.5, and various versions of Linux. 7

2.3 Using Geobrowsers for Thematic Mapping

Using geobrowsers for thematic mapping is quite a new endeavor. Geobrowsers have been used primarily for viewing existing, georeferenced images (Arrey, 2010).

Registering data to a known coordinate system, like State Plane, is known as georeferencing. Dataset registration is the process of determining the geometric transformation parameters of a dataset in one coordinate system, the source, with respect to the other coordinate system, the target. In the case of geobrowsers, the source is the image, the target is the Earth in a latitude/longitude coordinate system. This is the advantage of geobrowsers: they are already georeferenced to the Earth. Any data that contain latitudes and longitudes, even if inaccurate and imprecise, will show up in the correct or semi-correct location. This represents a great leap compared to even 2005, when the Google Maps interface was introduced, when it was difficult to put geospatial data on the web although as much as 80% to 90% of government information has a geospatial component (Folger, 2009). There were a few solutions, like ESRI’s

7 http://code.google.com/p/libkml/wiki/UserGuide12x

12

(Environmental Systems Research Institute) ArcIMS geobrowser, but ArcIMS is very basic. ArcIMS is proprietary and not free.

Geobrowsers are similar in style to the existing internet browsers: they have to be installed on the local computer and have access to compliant servers. The difference is in how they handle data. Geobrowsers allow for the handling of geographic data by tiling images of the earth’s surface and its features. Today, many geobrowsers are available:

Geobrowser Ownership 2D/3D KML Support 1 Google Earth Proprietary 3D Full 2 Google Maps Proprietary 3D Intermediate 3 Microsoft Live Proprietary 3D Basic Microsoft Virtual 4 Earth Proprietary 3D Basic 5 ArcGIS Explorer Proprietary 3D Intermediate Open 6 OpenLayers Source 2D Basic Open 7 WebGL Earth Source 3D No

Figure 3: Geobrowser selection (2012)

Figure 3 compares various geobrowsers that were considered for this thesis based on their popularity in geospatial forums and discussion boards.

Google Earth was chosen for this thesis because of the availability of products that are compliant with it. Google Earth is a standalone application for exploring 3D geovisualization. Users of Google Earth are initially drawn in by the feel of manipulating multiple views of a realistic 3D globe coupled with the ability to explore terrain and 3D models. Google Earth also uses the perspective projection which offers a good visualization of Polar regions. 13

2.4 Related Work

Bjorn Sandvik (2008) worked on KML visualization techniques and presented varying implementation. The extrusion techniques presented in his work used fixed symbol icons that could be scaled. The user had to create varying polygon icons for his desired shape of extrusion. This thesis created an extrusion technique that dynamic creates desired regular polygon extrusions based on multiple indicators.

Bjorn’s web-based solution did not offer the user an option to have his own data readily processed. The solution presented was a mapping engine which is used to create thematic visualizations based on the United Nations World Dataset. The implementation outlined in this thesis will extend Bjorn’s work by including user data input and subsequent processing into KML. Additional techniques that involve KML camera orientation, internal KML feature navigation, and raw data processing will be presented.

There are also a few web sites that implement thematic mapping for the user:

Website 1: http://datavisualization.ch/showcases/uuorld/ Pronounced “world.com”, allows 3D visualization with proprietary software, however, the site is unstable due to its invalid security certificate and non-compliance to web2.0 standards. We would like to create a stable website, similar to the idea of this site.

Website 2: http://www.earthpoint.us/ExcelToKml.aspx This website allows the uploads of Microsoft Excel file create KML point symbols that can be then loaded on the Google maps or Google Earth. Pop-up balloons, icons, and paths are created from the Excel data.

14

This is a very basic service, however, it partially achieves some of the goals of this thesis.

This thesis would like to expand the services that this site is capable of providing.

Many simple thematic mapping websites, not handled by geobrowsers, exist from

NASA and other government and private agencies, for example:

Website 3: http://www.scrol.gov.uk/scrol/common/home.jsp This is the Scotland Census

Results OnLine website. This site is notable for the input menu where the user can easily select from a wide range of data: age, population, employment numbers, year, display area, distribution type. The user can select many of the variables to input, however, not their own data.

The links below show efforts that Google is making towards create an API to help visualize data:

Web link 1: http://www.youtube.com/watch?v=8EsFJu6p3P4&feature=related

Web link 2: http://code.google.com/apis/visualization/interactive_charts.html

The Google Visualization API allows access to multiple sources of structured data that can be displayed automatically with a large selection of visualizations. Google

Visualization API enables showing data stored on any data-storage device that is connected to the web, being data sources with spatial components. It can create reports and interfaces as well as analyze and display data through available visualization applications. The Google Visualization API also provides a platform that can be used to create, share and reuse visualizations written by the developers. This thesis will extend this concept by creating and extensible platform for converting uploaded data into

15

multiple visualization schemes. The platform will also allow future advancements and techniques to be included as added profiles and made accessible to the public.

Website 4: http://censuskml.blogspot.com/ Census data are the most widely available and fit perfectly for thematic mapping applications. TIGER (Topologically Integrated

Geographic Encoding and Referencing) files are publicly available, and a program by

(Ralston and Streufert, 2008) is available to convert these data to KML for visualization.

All the above sites use limited tools that should be extended to a single more powerful tool.

16

Chapter 3: Data Description

This thesis used the Ohio Seis earthquake dataset to implement thematic KML visualization techniques. Supporting data was also taken from the 8United Nations World

Dataset and the 9US census, population and employment dataset.

3.1 Ohio Seis

Ohio Seis stands for The Ohio Seismic Network. Ohio Seis is a Division of the

Geological Survey of the Ohio Department of Natural Resources. There exist 27 seismograph stations throughout Ohio that continuously record earthquake activity under

Ohio Seis. Each station is connected to the internet for quick data transfer. The main objective of the Ohio Seis is to provide insight into earthquake risks in the state so as to make intelligent decisions regarding facility design, construction, insurance coverage, and planning. The Division of Geological Survey of the Ohio Department of Natural

Resources, in cooperation with the Ohio Emergency Management Agency, coordinates the network from the Ohio Earthquake Information Center at the Division’s laboratory facilities at Alum Creek State Park near Delaware, Ohio. Displays pertaining to Ohio

8 http://unstats.un.org/unsd/default.htm

9 http://www.census.gov/cps/

17

earthquakes and other aspects of Ohio are open to the public during normal business hours10.

In 2004, the Division of Geological Survey developed a 11web-based mapping system for displaying occurrences and earth conditions to the general public.

Figure 4: Ohio Seis online 2D mapping interface

3.1 Ohio Seismic Data

 The Ohio Seis website contains seismic data for Ohio. To choose the earthquakes,

the selection is >GIS and Maps>Interactive Maps>Earthquake epicenters12, then

select all of Ohio on the map, and the database table pops up. There are 131

records, each record contains:

10 http://www.dnr.state.oh.us/tabid/8144/Default.aspx

11 http://www.dnr.state.oh.us/website/geosurvey/earthquakes/viewer.htm

12 http://www.dnr.state.oh.us/website/geosurvey/earthquakes/viewer.htm

18

 Record # (Rec),

 Time (Year Month Day Hour Minute Second),

 Location (Latitude Longitude),

 Origin (Calculated Depth),

 Magnitude (Magnitude Magnitude Type),

 Intensity (Modified Mercalli intensity),

 Area of influence (Felt area),

 County (County),

 Reporting entity (Data Source),

 Report (Link to report),

 Instrument (Instrument Type ( and API (API #).

Figure 5 shows a snapshot of the Ohio Seis earthquake dataset.

19

Figure 5: Data Table

20

3.2 United Nations World Dataset

The Statistical Division of the United Nations has the primary function of collating global statistical data. The statistical data collected is disseminated to support countries’ efforts to strengthen their individual national statistical systems. Data from the

Division’s 2010 published Statistical Yearbook was used to simulate the thematic mapping techniques developed by this thesis. The Division's databases are available on http://unstats.un.org.

3.3 US Census, Population and Employment Dataset

The source of the US census, population and employment dataset is the Census

Bureau. The bureau is the nation’s trusted source for quality data about people and the economy of the United States. The most current census dataset can be found on http://2010.census.gov .

Residents in the United States use the census data to support community initiatives involving environmental legislation, quality-of-life issues and consumer advocacy. For each data use stated, KML visualization developed in this thesis can be used to improve the presentation of the issues by residents and community groups.

21

Chapter 4: KML Visualization and Thematic Mapping

Techniques

The under listed methods incorporate work carried out by this thesis to further display techniques used by KML.

4.1 XML Data Display

In 2010 when this thesis concept was being structured a study of 13XML data parsing within a Google Map API was carried out. It was clear from the onset that

Google was making efforts to incorporate their API with external datasets.

Figure 6: Google API 2D Mapping with layers

13 http://geoitconsult.com/webgis1/map2/testing.html

22

Figure 6 shows GPS facility data from Accra-Ghana displayed by using a single XML script and the Google API. The XML support allowed the creation of layers with toggled visibility. Below, Figure 7 displays a snippet of the XML code and the required files for supporting the display achieved in Figure 6.

Figure 7: Google Maps API implementation with XML data

Since 2010 Google has been working on creating add-ons for popular programming and visualization software to access the rich mapping capabilities of KML.

4.2 Auto Legend Implementation

Automatically displaying a maps legend was achieved by creating an image file for the legend in Microsoft paintbrush and calling it to be displayed within the KML code as an overlay. In the KML code there is a syntax that makes reference to the boundary

23

coordinates of an overlay. The code reference was used to place a legend image near the area of interest as the Ohio example shown in Figure 8.

Figure 8: Legend overlay implementation

4.3 Implementing Dynamic KML Polygon Extrusion

A consideration was given to displaying polygons and regions by using heights through extrusion. The motive was to create a distinction between features in thematic

24

maps and also to avoid the use of single scaled feature polygon icons. The solution lay in using bearing and angle computations.

Bearing and angle computations are used frequently in surveying for obtaining coordinates of points of interest. Because KML features have coordinates, it is possible to use surveying computation to ascertain vertices for a desired polygon display using each feature’s coordinates as the center of the shape. The computation used to generate the visualization in Figure 10 began by dividing 360 degrees by the number of polygon sides desired for the extrusion; which was 5 in this case resulting in a pentagon. In implementing this visualization for earthquake data, the length of the vertices of the polygon (d) was determined by scaled ratio of the earthquake’s frequency. This distance d represented each earthquakes felt distance.

Figure 9: Geometry for polygon extrusion implementation

With the felt distance known the vertices were computed by using each vertex angle measurement with its felt area distance in the equation:

Let (N,E) represent the coordinates of the center point (features coordinate), then 25

Vertex North Coordinate = N + dCosα Vertex East Coordinate = E + dSinα

Automated regular polygon extrusion

Figure 10: Dynamic polygon extrusion

In Figure 10 the extrusion height of each feature was computed by using the scalar multiple of the relative magnitude of each earthquake:

(Magnitude of earthquake/ Cumulative magnitude of dataset) X scalar = Polygon Height

The results obtained from the vertex computation and that of the polygon height determination were then inserted into a KML file structure to produce the extrusion visualization. In Figure 11 the obtained heights in the computation is inserted in the KML code structure.

26

Figure 11: Extrusion and code snippet for implementation

Fig. 3.1.2 Extrusion and code snippet for implementation 4.4 Raw Data Processing

A lot of data is in Microsoft Excel format (.xls/.csv) which has been a consistent stable file format in many disciplines. Since KML files do not support computations, the following method was used to prepare data for direct visualization support by KML.

KML supports embedded HTML tags and so does Microsoft Excel cell. HTML tags were created with spreadsheet column data using the concatenate function in Excel.

Converting Excel documents to KML requires formatting columns by using string joins

(concatenation) to form html tags. The data was sorted by the column which contained the earthquake magnitude values. Each magnitude value was used to form groups with similar display colors and group syntax.

This processing method made it possible to write a major portion of the KML programming code for a thematic data view in Figure 13 within Excel.

27

Figure 12: Creating KML code from Excel using HTML tags

Figure 13: Ohio Seis

28

The major challenge for KML code manipulate in these efforts was the required working knowledge in programming languages such as PHP, HTML, and Visual Basic for Application (VBA) required to manipulate data and key KML components.

4.5 Manipulating Camera Angle and Viewpoint

Within Google Earth, an observers viewpoint can be changed by altering the viewing angle of the observer relative to the observed using the cameras orientation. The initial virtual camera orientation has the x-axis fixed on the right vector as the y-axis points northward (up vector). The z-axis looks downward and is the primary view vector for image depth (zooming).

y

y-axis (up vector)

x-axis (view vector) x z-axis (look-at vector)

Figure 14: Viewpoint axis in Google Earth

Within Google Earth, the heading and roll is carried out by the z-axis and the x-axis caters for the viewing tilt. It was possible to manipulate KML’s structure to allow the

29

viewer to experience an intentional viewpoint, to drive an unconventional perspective view in 2D mapping.

Lincoln and Morrill Towers are the two popular high-rise buildings on the Ohio

State University Campus. Both towers stand at approximately 80 meters with 24 floors. It is possible to manipulate the viewing angle and coordinates of view to mimic an actual observer’s view of the campus area from within either Tower.

b. Camera Orientation: Heading 90o

a. Initial Camera Orientation

c. Camera Orientation: Heading 90o Tilt 70o d. Camera Orientation: Heading 90o Tilt 70o Roll -25o

Figure 15: Altering viewing camera orientation

In Figure 15 the camera parameters are altered using the format in the code snippet of Figure 16. The viewer can be intentionally presented a viewpoint created by the KML author.

30

In the KML structure the camera tag defines the orientation parameters.

Within this tag the camera orientation parameters are passed, producing the desired visual perspective.

Figure 16: KML Code snippet with camera parameters passed

4.6 Referencing KML-to-KML

In Google Earth, when large datasets are displayed it is difficult make out features in crowded areas. In other cases scattered content fall out of view. In each instance the user clicks on the feature label for the map to either zoom into view or have the information balloon of that icon to display. With live data feeds offered by network KML files, there is a need to hold the viewers attention on the same content. An engaging way to keep an attention span and focus is to implement an intuitive follow-up link between KML features.

31

kml-to-kml reference links

Figure 17: KML-to-KML referencing

KML-to-KML referencing involves using the KML code to call a feature from within another feature’s code snippet. KML-to-KML referencing presents a good way of associating a link between either camera orientations or actual individual kml files. This technique is most useful when displaying data that are spread across a large area or data that is related to create a ‘story’ or understanding pattern. Because many data series can share common kml displays this technique will create a re-usability for diverse kml files.

Alternatively, one would be required to include kml files repetitively into groups so that they display within each group that they may apply to.

32

4.7 Hotspot Image Placement

In Google Earth KML icon placement is biased by hovering over a placemark coordinate as an exact point. Though this is precise, it does not offer a good visual representation that could be achieved if the icon were to be pointing towards the point in question. The Ohio State University Oval crosswalk (Figure 18) is used to illustrate how placemarks can be ‘hotspotted’ to point towards a mark; in this case an edge of intersecting crosswalks.

A B

Identifying the edges of interest Default edge is green. Hotspot edge is red

Figure 18: Identifying edges of interest

In Figure 18, the left image has two edges of walkways marked with red and blue circles. The image on the right has the KML icon representing the coordinates of both edges. The red icon on image 2 has its displaced away from edge it is pointing to.

33

It’s evident that the default placement (Green-edge 1) covers the edge it highlights.

Implementing the hotspot involves the pixel displacement (minute shift) of the placemark so as not to obscure desired features/images on the map as shown in Figure 19.

y-axis

40 pixel shift on the vertical axis Original tip of icon/image

x-axis (0,0)

Figure 19: Hotspot implementation

34

Chapter 5: KML Web-based Thematic Mapping

Bjorn (2008) developed the framework for a Thematic Mapping Engine for KML display. There are two ways of using the application14: either as a web interface or an

API. This thesis added functionalities to the thematic application:

 Ability for users to upload their own data to the application (.xls/.csv)

 Ability for the administrator to extend the visualization implementations

of the application by creating additional visualization profiles.

This chapter described how the engine works and how further functionality may be incorporated.

5.1 The Thematic Mapping Engine

The Thematic Mapping Engine uses the United Nations statistical dataset and sets parameters for KML output. With the parameters fed into the thematic mapping engine, it returns a KML set file, which is then delivered back to the browser. Figure 20 outlines the workflow of the Thematic Mapping Engine. The MySQL data connector and PHP application deal with indicator settings while the mapping engine block inserts the parameters into a custom KML/KMZ file.

14 http://thematicmapping.org/engine/

35

Figure 20: The Thematic Mapping Engine

There are two ways of interacting with the engine: either by using a web interface or access through a PHP API. The web interface version of the Thematic Engine (Figure

21) uses Ajax and JSON (JavaScript Object Notation) techniques. Initially the interface requires statistical indicators, and then it outputs the users selection through the browser.

36

Figure 21: The interface of the Thematic Mapper

The processed KML file is returned to the browser as a link. If the Google Earth API is used, the KML file is instantly loaded. This thesis modified the PHP application to enable the user to use an external dataset, and extend data sharing by creating preset user visualization profiles (modules).

37

5.2 Web Interface Workflow

For users to upload external data in an updated Thematic Engine there was a need to create a workflow. In Figure 22 is the holistic framework that was defined to guide development.

Figure 22: Holistic approach to interface development

In this framework the user is allowed access to visualization profiles developed by the administrator (modules). The user capabilities and Module tasks were set with a PHP script that handles user uploaded files and initial template (module) validation.

Figure 23: Workflow for Module management and KML processing

38

Upon validation, parameters retrieved from the uploaded excel file are used in a subsequent query to retrieve code blocks from a MySQL database. The Thematic Engine is then used to combine parameters and code snippets to create a valid KML thematic structure with the visualization technique outlined in the module. Code based classes were added to the API which defined parameters that the input file had to adhere to.

Geospatial data tags were created during the processing of the users input into the valid

KML code structure and the result sent to the user as a link (downloadable file).

Figure 24: Files used in web implementation

Figure 24 shows the final files uploaded to the target webspace for public viewing: www.ebenezerodoi.com/thesis/Login.php. The scripts are all called at various stages of the processing to validate and join code blocks.

39

5.3 Web Interface Showcase

The location of the web service is www.ebenezerodoi.com/thesis/Login.php. Figure 25 displays the landing page of the web application.

Figure 25: Web interface developed

The user has an option to download processed KML files (KMZ) or Click the ‘Add

Profile’ button to create the desired visualization with their own dataset (Figure 26).

Figure 26: Add Profile Screen 40

Proceeding to click the ‘Add Profile’ will start the back-end processing of the spreadsheet file first through validation and then to KML structuring.

Zipped KML output file (KMZ)

Figure 27: KMZ Output put in queue as a module

Downloading and opening the KMZ output file will display the visualization achieved in

Google Earth (Figure 28).

Pike Meigs

Gallia

Lawrence

Figure 28: Choropleth KMZ output of selected counties in Ohio 41

What has been achieved will enable developers (Administrators) to share their visualization modules with a wide range of users. At the same time users will benefit from having direct access to modules that they can use on their data.

To track the use of the web application a download text file has was placed on the server to keep track of user IP addresses and visualization type used. In the future data from this text file can be used to track the spread of the application’s use worldwide.

The objective of building the updated interface is not to implement exactly what others have done in KML development but rather to create a platform to increase the extensibility between KML visualization developers and users.

42

Chapter 6: Conclusion and Future Work

The idea of this thesis was to:

. To create and explore visualization techniques that can be harnessed by the

Geospatial community.

. To create a free open platform for extending future web-generated visualizations for Geospatial based data.

The widespread availability of geospatial data will drive the data viewing transition towards a “Geospatial Web”. It facilitates the distribution of customized electronic content. Metcalfe's Law states that network value is proportional to the square of the number of users, and that individual user's utility is a linear function to network size (Swann 2002), which suggests first-user advantages and lock-in effects due to high switching costs once a network technology dominates the market. Consequently, successful business strategies for providers of geobrowsing platforms and distributors of geo-data based products built on top of these platforms use innovation to attract and retain users, quickly grow a community of like-minded individuals around a new technology and successively enlarge this community through synergy effects with other products and services. These future products will rely on advanced visualization

43

techniques that can unearth hidden trends in data. Open platforms like what this thesis developed will be a good foundation for the growth of Geospatial data viewing.

By integrating cartographic data with georeferenced data, whatever data that may be, from earthquakes to water pumps, the Geospatial Web “may ultimately be the big disruptive innovation of the coming decade” with many “unanticipated applications and social consequences” (Erle et al. 2005). As such, it will serve as a catalyst of social change and enabler of a broad range of as yet unforeseen applications. In recent times

Google has realized the need to store digital footprints of users, which in future could hold immense potential in studying geo-related environmental, social factors and how these affect livelihood, health, and basically the influence they have even on human behavior. API is currently one of the means with which data is achieved.

KML has the task of becoming “smarter”, better representing the real world data.

Currently efforts in this regard are left on developers using other programming languages who can pre-process data into KML standards. The most difficult part of implementing the processing strategy outlined in this thesis was the prior skill set required in other programming disciplines such as PHP, Javascript, CSS, and VBA.

Current geospatial innovation is being driven more and more by users. In the early years of GIS, coders created an application and distributed it with the appropriate software, like ArcView. The code was proprietary, and only used for the application, following some demand. “User-driven innovation,”—“a creation, a new device or

44

process resulting from study and experimentation” 15. User-driven GIS innovation will become more and more common, as the technology reaches more and more users.

I believe that the future direction is the merging of the capabilities of desktop

GIS/mapping with web-based functionality. What is radically different today is the broad adoption of GIS and new map forms, including geobrowsers16. In the early years, GIS and digital mapping was considered the domain of a relatively few. Today, it is used on phones and web-browsers. In just three decades it has evolved from an emerging science to a fabric of society that depends on its products from getting driving directions to sharing interactive maps of the family vacation.

In fact, the U.S. Department of Labor has designated Geotechnology as one of the three “mega-technologies” of the 21st century along with Nanotechnology and

Biotechnology. This broad acceptance and impact is in large part the result of the general wave of computer pervasiveness in modern society. Users expect information to be just a click away and spatial information is no exception. Proprietary GIS and mapping systems, once heralded as “toolboxes,” are giving way to web services and tailored application solutions. There are growing number of websites with extensive sets of map layers that enable users to mix and match their own custom views. Data exchange and interoperability standards are taking hold to extend this flexibility to multiple nodes on the web, with some data from here, analytic tools from there and display capabilities from

15 dictionary.com

16 http://www.innovativegis.com/basis/mapanalysis/Topic27/Topic27.htm

45

over there. The results are high-level applications that use generic programming language, not GIS/mapping language, and hide the complexity of data manipulation and obscure command sequences. In this new environment, the user focuses on the spatial logic of a solution and is hardly aware that spatial data is even involved.

Another characteristic of the new processing environment is the gradual integration of global positioning system and remote sensing imagery with spatial data. This is especially true of geobrowsers, where the user can load a traditional, georeferenced map or a satellite image to complement their data. All these different data modalities create an excellent data-viewing environment. In addition to the changes in the processing environment, contemporary maps have radical new forms of display beyond the historical 2D planimetric paper map. Today, the user expects to be able to

“drape” spatial information on a 3D view of the terrain. Virtual reality can transform the information from pastel polygons to rendered objects of trees, lakes and buildings for near photographic realism or symbology. Embedded hyperlinks access actual photos, video, audio, text and data associated with map locations. Immersive imaging enables the user to interactively pan and zoom in all directions within a display17.

4D GIS (XYZ and time) is the next major frontier. Currently, time in Google

Earth is stored and displayed as a series of stored map layers that can be animated to view changes on the landscape. Add predictive modeling to the mix and proposed management actions (e.g., timber harvesting and subsequent vegetation growth) can be

17 http://www.innovativegis.com/basis/mapanalysis/Topic27/Topic27.htm

46

introduced to look into the future. Tomorrow’s data structures will incorporate and completely change the conventional mapping paradigm. The future also will build on cognitive perspectives to improve data understanding and representation. These are not the usual quantitative measures amenable to computer algorithms and traditional decision-making models. This is what was meant by making KML “smarter”, written previously.

47

References

Adler D., (2011), Analyze DB2 spatial data with a free geobrowser, IBM Press Books-

New York.

Arrey, A., (2010), “Improving The Visualization of Geologic Data Using Google’s

KML”, Senior Thesis, The Ohio State University- Columbus Ohio.

Askay, S., (2011) , Developer Advocate & Technical lead for KML at Google, Google

Press .

Bacharach, S., (2008), “OGC Approves KML as Open Standard”, Geospatial Press

Releases. Available online : http://geospatialpr.com/2008/04/14/ogc-approves-kml-as- open-standard [Last accessed 29th May 2012].

Bertin, J.,(1967), “Semiologie Graphique”. Paris, La Haye, Gauthier-Villars.

Bossler, J., Campbell, J., McMaster, R. and Rizos, C., (2010), “Manual of Geospatial

Science and Technology”. Taylor and Francis Inc, New York.

Butler, D., (2006),”Virtual Globes: The web-6.wide world”, Nature volume 439, 16

February 2006. Nature Publishing Group, London. 48

Collada, (2008), “COLLADA”, The Khronos Group Inc. Beaverton, Oregon. Available online: http://www.collada.org/mediawiki/index.PHP/COLLADA [Last accessed 29th

May 2012].

Crowder, D. A.,(2007), “Google Earth for Dummies”, Wiley Publishing, Hoboken-New

Jersey.

Dietze, L. and Zipf, A. (2007), “Extending OGC (SLD) for

Thematic Cartography- Towards the ubiquitous use of advanced mapping functions through standardized visualization rules”, 4th Int. Symp. on LBS and Telecartography.

Hong Kong.

Dunfey, R. I.,Gittings B.M. and Batcheller, J.K.,(2006), “Towards an open for vector GIS”, Computers & Geosciences , Vol. 32 pp. 1720-1732. Elsevier Press

USA.

Erle, S., Gibson, R., Walsh, J., (2005), “Mapping hacks: tips & tools for electronic cartography”, O’Reilly Media Inc, Sebastopol- California.

Folger, P.,(2009) Geospatial Information and Geographic Information Systems (GIS):

Current Issues and Future Challenges, Congressional Research Service Report for

Congress.

49

Galdos, (2008), “KML released as an OGC Specification”, Galdos Systems Inc. ,

Washington. Available online: http://www.galdosinc.com/archives/498 [Last accessed

29th May 2012].

Goodchild M., (2008), “What does Google Earth Mean for the Social Sciences”, in,

“Geographic Visualization: Concepts, Tools and Applications”, Wiley Publishing,

Hoboken-New Jersey.

Google, (2008a), “KML Reference”. Available online: http://code.google.com/apis/kml/documentation/kmlreference.html [Last accessed 29th

May 2012].

Google, (2008b), “Google Maps API Terms of Service”, Google Code. Available online: http://code.google.com/apis/maps/terms.html [Last accessed: 29th May 2012].

Harvey, D., (1969), “Explanation in Geography”, Edward Arnold- London.

Hopkins, J., (2006), “Surprise! There's a third YouTube co-founder”, USA Today, 10-11-

2006. Available online: http://www.usatoday.com/tech/news/2006-10-11-youtube- karim_x.htm [Last accessed: 29th May 2012].

National Research Council (U.S.) Mapping Science Committee, 1993. “Toward a coordinated spatial infrastructure for the nation”, National Academy of Science Press,

Washington DC.

50

Ralston, B. A., and Streufert, J. A. (2008). Efficient generation of area thematic maps in

KML. Proceedings of the 16th ACM SIGSPATIAL international conference on Advances in geographic information systems GIS 08. Irvine, California.

Robinson, A.H., (1982), “Early thematic mapping in the history of cartography”,

University of Press- Chicago.

Sandvik, B., (2008), “Using KML for thematic mapping”, University of Edinburgh.

Available online: http://thematicmapping.org/downloads/Using_KML_for_Thematic_Mapping.pdf [Last accessed: 29th May. 2012].

Scharl ,A., and Tochtermann, K., (2007), “The Geospatial Web: How Geobrowsers,

Social Software and the Web 2.0 are Shaping the Network Society (Advanced

Information and Knowledge Processing)”, Springer-Verlag, London.

Swann, G. M., (2002). “The functional form of network effects”. Information Economics and Policy, 14(3), 417-429. Elsevier Press USA.

Udell, S., (2009), “Beginning Google Maps Mashups with Mapplets, KML, and GeoRSS: from novice to professional”, Apress-Springer/Verlag, New York.

UN world economic data =>> http://unstats.un.org/unsd/default.htm

US census, population and employment data =>> http://www.census.gov/cps/

51

Wernecke, J. (2009) “The KML Handbook - Geographic visualization for the web”,

Addison-Wesley, San Francisco.

Wilson, T., (2008), OGC KML 2.2.0, OGC. Available online: http://www.opengeospatial.org/ogc/policies/ [Last accessed: 29th May. 2012].

52

Appendix: Links to Programming Codes and Data

All source codes for this thesis can be downloaded from:

a) Web Implementation: www.ebenezerodoi.com/thesis/codedocumentation.zip

b) KML files created for this thesis: www.ebenezerodoi.com/thesis/KML.zip

Datasets (Ohio Seismic data): www.ebenezerodoi.com/thesis/ohioseis.zip

53