LANDSLIDE CORRIDOR HAZARDS – WEB TOOL Ravi Thakkar B.E., Dharmsinh Desai University, 2006 PROJECT Submitted in partial satisfaction of the requirements for the degree of MASTER OF SCIENCE in COMPUTER SCIENCE at CALIFORNIA STATE UNIVERSITY SACRAMENTO FALL 2009 LANDSLIDE CORRIDOR HAZARDS – WEB TOOL A Project by Ravi Thakkar Approved by: _______________________________, Committee Chair Dr. William J Mitchell _______________________________, Second Reader Mrs. Gita Faroughi _________________________ Date ii Student: Ravi Thakkar I certify that this student has met the requirements for format contained in the University format manual, and that this project is suitable for shelving in the Library and credit is to be awarded for the Project. ___________________________, Graduate Coordinator Dr. Cui Zhang Department of Computer Science iii ____________________ Date Abstract of LANDSLIDE CORRIDOR HAZARDS – WEB TOOL by Ravi Thakkar Hundreds of landslides are mobilized along highway corridors that can affect public safety as well as the trip quality, reliability and maintenance cost of the transportation network. Caltrans GeoResearch Group pioneered the project to identify the landslides along California State Highways. 187 out of 1200 miles of identified landslide-prone corridors were mapped between 1999 and 2006 by Caltrans GeoResearch Group with the help of California Geological Survey. These landslides were captured in Environment System Research Institute, Inc (ESRI) Shapefile that can be viewed in ArcGIS or other common GIS Software. The task is to convert 3 out of 7 shapefile generated from prior study into a web-base tool using Google Maps. This web-based system will map all 1200 miles of Landslide prone State wide Highways with detailed information of subset of 187 miles of these corridors. Landslides will be displayed in the map as polygons in different colors based on their activity so that they can be easily identified. Landslide polygon shape border thickness is iv based on the Landslide Confidence level attribute. Information about each landslide including links to relevant reports will be presented to the user through Google Maps Info-Window. The web-based system will also have the capability to generate reports summarizing landslide information in tables and map, based on different user defined criteria. This system will be implemented in PHP, JavaScript and Google Maps API. The data will be maintained on a MySQL database. This system will be integrated in Caltrans Geotech web based system. _______________________, Committee Chair Dr. William J Mitchell _______________________ Date v ACKNOWLEDGEMENTS The Success of this project depends largely on the encouragement provided to me by my advisor and many others. I take this opportunity to thank all the people who have been involved in the successful completion of this project. First I would like to thank my project advisor Dr. William Mitchell. I received great support and help from him every time went to meet him. Without his guidance, this project would not have been successfully finished. I would like to thank Mrs. Gita Faroughi for being my second reader and helping me with the project. I would like to thank Mr. Loren Turner, Senior Transportation Engineer, CaltransDivision of Research & Innovation, GeoResearch Group. He has been always supporting to me. He has provided valuable guidance starting from initial stage of project to the successful completion of this project. Finally I would like to thank my family and friends for their continuous encouragement and support. vi TABLE OF CONTENTS Page Acknowledgements ............................................................................................................ vi List of Figures ..................................................................................................................... x List of Tables .................................................................................................................... xii Chapter 1. INTRODUCTION .......................................................................................................... 1 1.1 Background .......................................................................................................... 1 1.2 Scope .................................................................................................................... 2 1.3 Overview Of This Document ............................................................................... 3 2. TOOLS AND TECHNOLOGY USED FOR LANDSLIDE HAZARDS ONLINE ...... 4 2.1 PHP....................................................................................................................... 5 2.2 HML ..................................................................................................................... 6 2.3 JavaScript ............................................................................................................. 6 2.4 MySQL ................................................................................................................. 7 2.5 Sytem Requirements ............................................................................................ 8 3. FUNCTIONAL REQUIREMENTS AND DATABASE DESIGN ............................. 10 3.1 Functional Requirements.................................................................................... 10 vii 3.2 Database Design ................................................................................................. 18 3.2.1 Data Dictionary ........................................................................................... 18 3.2.2 Database Table Range Of Values ............................................................... 20 3.2.3 ER Diagram ................................................................................................ 22 3.2.4 Detail Information Of Landslide Table Attribute ....................................... 23 4. IMPLEMENTATION OF LANDSLIDE HAZARDS ONLINE ................................. 33 4.1 Shapefile To KML File Conversion ................................................................... 33 4.2 KML To XML File Conversion ......................................................................... 34 4.3 Storing XML File Into MySQL Database Tables .............................................. 34 4.4 Google Maps API ............................................................................................... 35 4.4.1 Start Using Google Maps API .................................................................... 36 4.4.2 Google Maps Events ................................................................................... 36 4.4.3 Google Maps Overlays ............................................................................... 37 4.4.4 Google Maps API Drawbacks .................................................................... 39 5. RESULTS AND SNAPSHOTS .................................................................................... 41 5.1 Initial Map Load ................................................................................................. 41 5.2 Map At Zoom Level 8 ........................................................................................ 42 5.3 Map At Zoom Level 10 ...................................................................................... 43 viii 5.4 Landslides At Zoom Level 15 ............................................................................ 46 5.5 Display Landslide Attribute When A Landslide Is Clicked ............................... 47 5.6 Postmile Selection On Map ................................................................................ 48 5.7 Postmile Query Result ........................................................................................ 49 5.8 Postmile Result Print View ................................................................................ 51 5.9 Result Table Sorted Output Based On Sorting Attributes.................................. 52 5.10 Testing Results ............................................................................................... 55 5.10.1 Marker Clicked Not On Highway ............................................................... 55 5.10.2 Wrong Postmile Input Format Entered In The Text Box ........................... 56 5.10.3 Wrong Route Number Is Given In Postmile Selection ............................... 57 5.10.4 So Many Landslides Found Between Two Postmile Point Range ............. 58 6. CONCLUSION AND FUTURE EXPANSION ........................................................... 59 6.1 Conclusion.......................................................................................................... 59 6.2 Future Expansion................................................................................................ 60 Appendix A Map Load .................................................................................................... 62 Appendix B Phpresultquery ............................................................................................. 70 Bibliography ..................................................................................................................... 74 ix LIST OF FIGURES Page Figure 3.1 Landslide Perimeter Outline Level .................................................................. 12 Figure 3.2 Landslide Metadata Attributes Info-Window Display .................................... 15 Figure 3.3 Display Landslide And Create Report Based On Postmile Limit ................... 17 Figure 3.4 ER Diagram ..................................................................................................... 23 Figure 3.5 Rockslide Landslide ........................................................................................ 25 Figure 3.6 Earth Flow Landslide ...................................................................................... 27 Figure 3.7 Debris Slide ..................................................................................................... 28 Figure 3.8 Debris Flow Landslide .................................................................................... 29 Figure 3.9 Debris Slide And Debris Flow Landslide ........................................................ 30 Figure 5.1 Initial Map Load At Zoom Level 6 ................................................................. 41 Figure 5.2 Map At Zoom Level 8 ..................................................................................... 42 Figure 5.3 Mendocino County Landslide Corridor Image Overlay At Zoom Level 10 ... 43 Figure 5.4 Sonoma County Landslide Corridor Image Overlay At Zoom Level 10 ........ 44 Figure 5.5 Monterey County Landslide Corridor Image Overlay At Zoom Level 10 ...... 45 Figure 5.6 Sonoma County Landslide At Zoom Level 15 ................................................ 46 Figure 5.7 Sonoma County Landslide At Zoom Level 15 With Map Info Window ........ 47 Figure 5.8 Postmile Endpoint Selection Showing Two Markers And Postmile Value .... 48 Figure 5.9 Postmile Query Result On Map ....................................................................... 49 x Figure 5.10 Landslide Result Table .................................................................................. 50 Figure 5.11 Postmile Result Print View On Map ............................................................. 51 Figure 5.12 Postmile Result Print View In The Table ...................................................... 52 Figure 5.13 Landslide Result Table Output Sort Based On Activity ............................... 53 Figure 5.14 Landslide Result Table Output Sort Based On Area ..................................... 54 Figure 5.15 Error Message When Marker Is Not Near Highway ..................................... 55 Figure 5.16 Error Message On Wrong Input Format ........................................................ 56 Figure 5.17 Error Message When Incorrect Route Entered In Postmile Textbox ............ 57 Figure 5.18 Error Message When So Many Landslides Between Two Points Range ...... 58 xi LIST OF TABLES Page Table 3.1 Landslide Region Colors Fill Based On Landslide Activity Table .................. 13 Table 3.2 Landslide Metadata Attributes Information Table............................................ 14 Table 3.3 Coordinate Table............................................................................................... 18 Table 3.4 Landslide Table................................................................................................. 19 Table 3.5 Coordinate Table Attribute Range Of Values................................................... 20 Table 3.6 Landslide Table Attribute Range Of Values..................................................... 21 xii 1 Chapter 1 INTRODUCTION 1.1 Background Each year, hundreds of landslides move along highway corridors that can affect public safety as well as the trip quality, reliability and maintenance cost of the transportation network. Modern GIS-based technologies have created new opportunities for improved assessment of landslide hazards by enabling comprehensive synthesis of vast amounts of spatial data developed from field evaluations, various remote sensing techniques, and an assortment of archival information residing with federal, state, local and private entities. Under the direction of the Caltrans GeoResearch Group (GRG) in the Division of Research & Innovation, the California Geological Survey (CGS) piloted the development of corridor-scale landslide hazard maps to meet the needs of various Caltrans users. Back in 1999, a study was initiated by Research through a contract with CGS to map corridors with landslide hazards. CGS group mapped 187 miles out of 1200 miles of identified landslide-prone corridor California state highways between 1999 and 2006. This mapping was done in GIS shapefile format. Environmental Systems Research Institute, Inc’s different software supports Geographic Information Systems (GIS) mappings. ESRI Arch Map viewer, ESRI ArcGIS, MapWindow GIS and many more software allows you to create custom maps in shape (shp) file format. The .shp file stores geologic attribute information and coordinates of the points in the form of shape. 2 These landslides are spread across seven different counties. Each county has its own separate shapefile and database. The reason for separate shapefile(s) for different counties is, each county was mapped by different teams of geologist and each team used their own format to represent the geological area. Shapefile(s) can be viewed by ArcGIS, Map Window GIS or any other GIS software. The user has to install selected GIS software to create or view shapefile(s). The user also needs to carefully analyze the shapefile to locate an actual landslide in the map. The user also needs to be experienced to analyze Landslides and its metadata attributes in ArchMap Viewer or any other GIS software. The Landslide Hazards Online is a web-based system which was designed and implemented after careful analysis of user requirements. It is implemented with a PHP/JavaScript/Google Maps API/MySQL environment. This web-based system will have centralized database of Sonoma, Monterey and Mendocino counties’ Landslides. This new tool will be web based and it does not require additional software installed in the Client Side workstation. As this tool is implemented using Google Maps API, its user interface mimics Google maps user interface and it is very simple and easy to learn. 1.2 Scope The scope of this project is to convert three out of the seven shapefile(s) generated from the 1999 study into a web-based tool using Google Maps. The reason for implementing only three out of seven file formats was basically due to the insufficient data and the timing constraint associated with the completion of the project. This web-based system 3 will display 1200 miles of identified landslide prone highways with detailed information of subset miles of these corridors. Landslides are displayed in the map as polygons in different colors based on their type and activity so that they can be easily identified. Information about each landslide including links to relevant reports is being presented to the user through Google Maps Info-Window. This tool allows Engineers, geologists and planners to identify landslides that affect a particular highway area or region. The webbased system also has the capability to generate reports summarizing landslide information in tables and map, based on different user defined criteria. This tool is very helpful for easily locating landslides that affects highways and will reduce the overall time to assess landslide hazards. 1.3 Overview Of This Document Chapter 2 will discuss the tools and technology used for this project. Chapter 3 will include Functional Requirements and Database Design. Chapter 4 describes Implementation techniques used for this project. Chapter 5 shows Results and Snapshots. Finally, Chapter 6 is Conclusion and Future expansion followed by Appendices. 4 Chapter 2 TOOLS AND TECHNOLOGY USED FOR LANDSLIDE HAZARDS ONLINE Geographic Information Systems (GIS) integrates hardware, software and data for capturing managing, analyzing and displaying all forms of geographic based information [1]. There are many GIS software systems available in software Industry that help Geotech engineers in planning the maps. Typical GIS file format is shapefile format. Environmental Systems Research Institute, Inc’s different software supports Geographic Information Systems (GIS) mappings. ESRI Arch Map viewer, ESRI ArcGIS, MapWindow GIS and many more software allows you to create custom maps in shape (.shp) file format. “The shp files stores non topological geometry and attribute information for the spatial features in a data set. The geometry for a feature is stored as a shape comprising a set of vector coordinates.” [2]. To create, view and edit shapefile(s) one must have GIS software installed in workstation. The project’s main requirement is to have web-based intranet site so that it eliminates the need of installing specific GIS software on the user machine for analyzing landslides between particular areas under observation. Yahoo, Google and many other maps APIs are available which allows easy embedding of interactive maps into web based application. Google maps JavaScript API is an open source API. Google maps API lets web developers embed Google maps in their own web pages regardless of web 5 development technologies because it is a JavaScript based API. Landslide Hazards Online has a feature to see Landslides in Terrain View. Terrain View has the ability of showing elevation data to geographic features like mountains, hills and valleys. Landslides can only occur in mountains, hills, valleys with a slippery surface. Google maps Terrain view contains label for even small mountains and trains and contains subtle shading that can often give a better sense of elevation changes than a satellite image alone. This is one of the reasons for selecting Google maps API to develop web application. This web application is developed with scripting language that can read the MySQL database as well as generate web contents that can be viewed in a browser and Google maps. 2.1 PHP PHP is a widely used general-purpose scripting language that is especially suited for dynamic web site development and embedded HTML [3]. PHP-enabled web pages are treated just like regular HTML pages and the developer can create and edit them the same way he/she creates regular HTML pages [4]. PHP is a server side scripting language. Thus, all scripting code runs on the server. PHP is a portable server side scripting language. This is the key point for selecting PHP. Current development of Landslide Corridor Hazards web application is developed in Windows XP professional environment running Apache web server. But final installation 6 may be on UNIX machine environment. Thus, it does not require any script conversion even if it is ported to other production machine. PHP is lightweight and it is designed for web. PHP version 5.2.6 is used for the development of this project. 2.2 HTML PHP script generates HTML output and writes to the browser. This project requires HTML version 4 and XHTML 1.0 supported web browser. 2.3 JavaScript Client-side scripting is necessary to improve the design, validation, and manipulation of the HTML web page. JavaScript is perfect choice for this because it can be embedded into HTML pages. JavaScript is a scripting language. It works in almost all the major web browsers, such as Internet Explorer, Firefox, Opera and Google Chrome. JavaScript is an interpreted language, which means scripts execute without any preliminary compilation. JavaScript does not require any license for its use [5]. User registration validation and input form validation can be made to client side with the use of JavaScript, and no need to validate the authentication data on the server. Since, this is an intranet based system hosted on a secure Caltrans server it omits the possibility of tampering with the client side authenticated data. Thus, we can reduce the server load by validating unsecured data to client side using JavaScript. 7 2.4 MySQL MySQL is a database management system (DBMS). A database can be thought as an organized collection of records containing data for a specific purpose that can be searched and retrieved. A DBMS system allows user to easily insert, update, delete and query data. DBMS stores data in the form of related tables. The advantages of using MySQL as the DBMS are described below. 1. Open Source – MySQL is duel licensed. User can choose to use MySQL software as an Open Source product under the terms of GNU General License (http://www.fsf.org/licensing/licenses/) or can purchase a standard commercial license from MySQL AB. Like PHP, MySQL can be used as open source product. The main goal of this project is to use open source products and software as much as possible. Therefore, MySQL is main choice for selecting it for this project. 2. Lightweight- MySQL has a lightweight and highly portable user interface. This interface facilitates the user to access the data in highly efficient way. This web application is currently using MySQL community server 5.0.45 for windows environment. Its size is only 43 MB. MySQL GUI Tools 5.0 size is also only 33MB. 3. In this project, Landslide Meta data attributes like landslide type, activity, confidence, Primary geology units, secondary geology units, area, acres, perimeter and many more are stored in Landslide database table landslide. Each landslide has a unique id associated with it. Thus, a Landslide can be uniquely identified by its id as its primary key. Each landslide must have number of coordinate points associated with it. Each landslide coordinate point consists of Longitude and Latitude pair. The coordinate 8 table stores landslide id and its associated number of coordinate pair points. We can draw a Landslide (polygon) in the map by retrieving all the points from MySQL. 2.5 System Requirements At the server side, the application needs a Pentium processor P4 or higher end processor. Minimum of 256 MB RAM is required. Hard disk free space of 7GB is required to install all the required server side software. On server side, this application is currently hosted on Windows XP operating system. However, any server side operating system like Windows 2000 NT can be used as well. Web server for current application is Apache 2.2.9 but Apache 2.2.9 or higher version of the web server can also be installed. Server side scripting language is written in PHP 5.2.6 version or higher for this application. The database server for this application is MySQL 5.0 or higher. Alternatively XAMPP 1.6.7 version or higher can be installed as well. XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use - just download, extract and start. This application is using Caltrans Intranet web service, so PHP Curl support must be enabled to use the web services. PHP Curl is a library that allows you to connect and communicate to different types of servers with different types of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading (this can also be done with PHP's ftp extension), HTTP form based upload, proxies, cookies, and 9 user+password authentication[6]. By default, this library is disabled in PHP. To enable this library uncomment this library in php.ini configuration file. At the client side, a Pentium processor P3 or any higher end processor is required to run this application. Minimum of 256 MB RAM is required. A VGA color monitor with 24bit high color resolution is required to view maps with good resolution. Color Laser or Color Inkjet printer is required to print the maps. The user can use this application on Windows 9X, Windows 2000, XP, Vista, Red Hat, Fedora or any Linux operating system that supports Firefox 2.0 or higher web browser. This application runs in Internet Explorer 6 or higher, Firefox 2.0 or higher, and Google Chrome. However, for the better performance of this application to run, Internet Explorer 7 or Firefox 2.0 or higher version is suggested. At the client side, high-speed internet connection of at least 1.5mbps is required for this application to run. 10 Chapter 3 FUNCTIONAL REQUIREMENTS AND DATABASE DESIGN This chapter provides an in depth analysis of the functional requirements and overview of the database used for Landslide Hazards Online. 3.1 Functional Requirements Functional requirement is a set of functions consisting of software system and/or its components which are used for describing the behavioral aspect of the system. It can be represented by a wide variety of aspects ranging from technical data and it manipulation to specific requirements of a system would perform in real world. Four main functional requirements of this web application are described from R1 to R4. R1: Select view Description: Select view function selects a view from different views like map view, Satellite View, Terrain View, and Street View on the Google Maps. User can also zoom in and zoom out the map. Zoom in can be done either by double clicking on the map on a particular region or by clicking the plus button on zoom bar. Zoom out can be done by clicking on minus button on zoom bar. Map can be moved either by dragging mouse to other region or by clicking on left, right, up and right arrow buttons on the Google map. 11 R2: Display landslide on large-scale zoom out functionality Description: This function will display all landslide prone freeways, landslide identified freeways, and freeways that has been successfully mapped on Google maps. R2.1: Display all landslide prone freeways Description: This function will display all 1200 miles of slide- prone corridors identified by Caltrans staff in early stages of corridors project. The data identified during this stage indicates the most probable area in which there is a probability of landslides. R2.2: Display landslide identified freeways Description: This function will display seven different study areas as a one-mile wide polygon showing where mapping has been completed. R2.3: Display landslide mapped successfully from shapefile to Google maps Description: Google Earth TM is the GIS software by Google TM . User can create custom maps using Google Earth. Google Earth file format is .kml file format. This function will display three different study areas out of seven different study areas where shapefile(s) have been successfully converted to Google Earth .kml file and its metadata information has been successfully stored in database. R3: Display landslide on small-scale zoom in functionality Description: This function will display landslides based on different criteria provided by user and display landslide metadata information like activity, movement, area, etc. 12 R3.1: Display landslide perimeter outline based on confidence level. Description: This function will draw landslide perimeter line thickness based on 3 levels of ‘confidence of interpretation’. Categories of confidence of interpretation are DEFINITE, PROBABLE, and QUESTIONABLE. Convention: Figure 3.1 Landslide Perimeter Outline Level This feature has been implemented. All the screenshot depicted here are from the Landslide Hazards Online. 13 From Figure 3.1, user can clearly identify the confidence level of Landslide. Definite Landslide has thickest border. Probable Landslide has average border. Questionable Landslide has thinnest border. R3.2: Display landslides Description: This function will display landslides according to its activity. Landslide color is based on 4 levels of activity like ACTIVE, DORMANT-YOUNG, DORMANTMATURE and DORMANT OLD. Table 3.1 clarifies the colors used for Landslide Hazards Online system based on activity of landslide. Activity Color Active or Historic Dormant-Young Dormant- Mature Dormant- Old Table 3.1 Landslide Region Colors Fill Based On Landslide Activity Table R3.3: Display landslide metadata information Description: when user clicks on one particular landslide, its metadata information will be display in a MapInfo Window. Table 3.2 describes this functional requirement in detail. Figure 3.2 illustrates this requirement. 14 Attribute Value Description ID Integer between1 to 4000 Uniquely identify Landslide Level of Confidence Definite Probable Questionable Debris Flow Debris Slide Rock Slide Earth Flow Active/Historic Dormant-Young Dormant-Mature Dormant-Old Area in meter squares Severity of the Landslide Depth Direction of Movements Floating point Value Here in this mapping Landslide is considered as shallow if its depth is less than three meter, its is considered as level medium if depth is between three meter to 15 meter and considered as deep level if depth is greater than 15 meter. Measurement unit is Geologic unit Azimuth Landslide Type Landslide Activity Area Shallow, Medium, Deep, Geologic Primary Lithology Secondary Unit Classification of Landslide based on its recent activity. Landslide area occupied on the land in square meter. Any special comment related to particular landslide. Comment Primary Unit Landslide type based of soil initial movement when it occurred Geologic KJFm KJFbf. Ss sh ss-sh. KJFm KJFbf. The geologic unit from the geologic map. In this area all landslides involve either KJFm, Franciscan melange or KJFbf, Franciscan broken formation Corresponding to the unit on the geologic map. The lithologies are ss, sandstone, sh, shale and sssh, sandstone with lesser shale If a landslide involves two bedrock geologic units If a landslide involves two bedrock geologic units BedRock Strike Ss sh ss-sh. Azimuth BedRock Dip 0-90 Measurement unit is in degrees Secondary Lithology Corridor report Measurement unit is Geologic unit Azimuth Link to full text(PDF) Region Report Table 3.2 Landslide Metadata Attributes Information Table 15 Figure 3.2 Landslide Metadata Attributes Info-Window Display R4: Create standard report Description: This function will create report table and create map based on postmile1 search and other user-defined criteria. R4.1: Display map and create table based on postmile1 limits Description: Area considered by report is based on postmile1 limits entered as text or as endpoint clicks on map interface. Map/report area considered should extend approximately 1-mile from max/min lat/long limits of postmiles considered. 16 The Figure 3.3 represents expected result output about this requirement. Here user can search landslide either by entering postmile1 limits in the text or by clicking two endpoints on map. If user search landslide by clicking its endpoints its postmile1 values of two points are displayed on text as well. 1. California State Department of Transportation has uniquely identified all the Highways with the postmile measurement system. It consists of County name, Rout number, mile number, mile prefix, and mile postfix. Unfortunately, over time postmiles have been rendered invalid as measures as highways have been shortened or lengthened due to changes in alignment. Rather than re-postmile the route from realignment and beyond, just the affected portion is repostmiled, and given a character prefix (most commonly “R”) that differentiates it from the original postmile There can also be a postmile suffix that indicates the side, or direction where there are Split, or Independent Alignments. Values of Postfix are L-Left side, R-Right Side or B-Both. Exaple of Postmile measurement system is Mon, 1, R, 65.037, L here Mon is County value , 1 is Rout number passing through monetary county, R is route prefix, 65.037 is mile number, and L is the postfix value. 17 Figure 3.3 Display Landslide And Create Report Based On Postmile Limit R4.2: Create map/report based on user defined selection Description: This function will provide user interface to select map features to be displayed based on user defined criteria of direct movement, initial movement, primary geology, secondary geology, primary litho logy, secondary litho logy. 18 R4.3: Table sort Description: This function will provide functionality to sort table rows based on user defined column attribute of the Landslide metadata table. 3.2 Database Design Previous shapefile(s) internally was using database DBF file format. One of the main reasons for going with a new Google Maps API based Landslide Hazards Online was to use open source technology, so for that reason MySQL fits the needs for this project conversion. Detail explanation of how the conversion has been done is explained in chapter5. 3.2.1 Data Dictionary Data dictionary represents information about data such as meaning, relationships to other data, origin, usage, and format of a database. Table 3.3 and Table 3.4 represent Landslide database tables’ attribute, its data type and description of each attribute. Attribute MySQL Type Description ID(FK) Unsigned int(10) Foreign Key on Landslide(ID) Lng(not null) Double Longitude attribute of point Lat(not null) Double Latitude attribute of point Sequence(not null) Unsigned int(10) Each landslide consists of series of points. Sequence number represents the point in the series list. Part_id(not null) Unsigned int(10) Landslide may consist more than one part. Table 3.3 Coordinate Table 19 Attribute MySQL Type Description Id(PK) Unsigned int(10) Uniquely identify Landslide Activity(not null) Varchar(10) Activity of Landslide Init_mov(not null) Varchar(10) Initial movement of Landslide Confidence(not null) Varchar(10) Severity of the Landslide Depth(not null) Char Depth level of Landslide. It is Deep, Medium, or shallow. D->Depth M->Medium S->Shallow Scrap_dep Char Scarp Depth. It is Deep, medium or shallow D->Depth(>15 meter) M->Medium(between 3 to 15meter) S->Shallow(<3meter) Dir_mvmnt Unsigned int(10) Direct movement of Landslide. Photo_yr Unsigned int(4) Photo year of Landslide Comment Varchar(50) Any special comment for the landslide Area(not null) Double Area of the landslide Acres(not null) Double Acres of the landslide Perimeter(not null) Double Perimeter of the landslide Table 3.4 Landslide Table 20 3.2.2 Database Table Range Of Values Table 3.5 and Table 3.6 describe MySQL Tables Landslide and Coordinate table attributes, MySQL type and range of possible values of attributes in the database Attribute MySQL Type Range of Values ID(FK) Unsigned int(10) 1 to 4209. Lng(not null) Double -123.7973010553 to -121.2973293844. California Longitude values are in range between -116 to -124. There is 10 digit precision after decimal point for the Lng value. Lat(not null) Double 35.7571641322 to 39.9459691757. California Latitude Values are in range between 32 to 43. There is 10 digit precision after decimal point for the Lat value. Sequence(not null) Unsigned int(10) Sequence number starts with 1 to maximum number of points a landslide in sequence. Typical Landslide may consist of more than 4000 points in sequence. Each landslide consists of series of points. Sequence number represents the point in the series list. Part_id(not null) Unsigned int(10) Part_id starts with 1 and range of may vary depending on the number of parts a landslide consists. Default value is 1. Table 3.5 Coordinate Table Attribute Range Of Values 21 Attribute MySQL Type Range of Values Id(PK) Unsigned int(10) 1 to 4209. Currently there are total 3328 records in the landslide Table. Activity(not null) Varchar(10) Value is(‘H’,’Y’,’M’,’O’) H->Historic Y->Young M->Mature O->Old Init_mov(not null) Varchar(10) Values in(‘RS’,’DF’,’DS’,’EF’,’DFF’,’RF’) RS->Rockslide DF->Debris Flow DS->Debris Slide EF->Earth Flow DFF->Debris Slide and Debris Flow RF->Rock Flow Confidence(not null) Varchar(10) Values in (‘D’,P’’,’Q’) D->Definite P->Probable Q->Questionable Table 3.6 Landslide Table Attribute Range Of Values 22 Attribute MySQL Type Range of Values Depth(not null) Char Values in(‘D’,’M’,’S’) D->Depth M->Medium S->Shallow Scrap_dep Char Scarp Depth. It is Deep, medium or shallow D->Depth M->Medium S->Shallow Dir_mvmnt Unsigned int(10) Movement of landslide starting from 1 to number meters from its origin Photo_yr Unsigned int(4) Between 1959 to 2004 year. Comment Varchar(50) Any special comment for the landslide Area(not null) Double Range between 0 to max area of landslide in square meter Acres(not null) Double Range between 0 to max acres of landslide Perimeter(not null) Double Range between 0 to max perimeter of landslide in meter Table 3.6 Landslide Table Attribute Range Of Values(Continue) 3.2.3 ER Diagram ER (Entity Relationship) Diagram represents abstract and conceptual representation of data. Entity-relationship modeling is a database modeling method used to produce a type of conceptual schema of a database; Diagrams created by this process are called entityrelationship diagrams, ER diagrams. Figure 3.4 represents entity relationship between landslide and coordinate table of landslide database. 23 Landslide 1 Shapes n Coordinate id id activity lng init_mov lat confidence sequence depth part_id scarp_dep dir_mvmnt photo_yr comment area acres perimeter Figure 3.4 ER Diagram 3.2.4 Detail Information Of Landslide Table Attribute “Caltrans have classified, recognized and mapped landslides based on their geomorphology” [8]. The following description up to and including the section 24 ‘Confidence of interpretation’ is a re-expression of material, again from [8] and [9]. “Landslides displace parts of the earth’s surface in distinctive ways, and the resulting landforms can show the extent and characteristics of the landslide”. It helps the geologist to recognize, map and classify most landslides based on different landforms like scarps, troughs, benches and other subtle geology topological features. The Term Scarp means a line of cliffs formed by the faulting or fracturing of the earth's crust [7]. Landslides were recognized and mapped by taking aerial photographs and by visiting the actual site where landslide occurred. Caltrans recorded and mapped landslides based on Wieczorek (1984) recommendation. Type of the Landslide: “Landslides are classified according to the materials involved and its movement type.” Landslide soil materials are either rock or soil. Soil material is subcategorized into finegrained (called earth) and coarse-grained (called debris). Different types of Landslides are rockslide, debris slide, debris flow, debris slide and debris flow, and earth flow. Detail description of each landslide type is explained in this section. Landslide types are categorized based on Cruden and Varnes standard. 25 Rock Slide: Figure 3.5 Rockslide Landslide This type of landslide usually preserves the original structure of its own and soil. Bedding plans and joints loosens the strength of the rock in this type of slide. They are considered as the weak zones in the rockslide landslide which loosens the soil material hardness. Generally, these landslides move down words on the slide planes. Slide plan is defined as the slope on one or several shear surfaces. Rockslides usually occur on steep slopes in the rock structure. Slope depth is in between 35% to 70%. Upper region of the rockslide landslide is very steep as it is seen in Figure 3.5. 26 Figure 3.5 is taken from page 10 in [8]. Big and steep rockslide also affects the down words slope of the earth soil surrounding the rockslide landslide. Heavy rainfall or water level rise in the soil decreases the stability of this type of landslide. Movement of this type of landslide is usually slow. It is between millimeters per year, and it is incremental. This type of landslide usually occurs when higher than normal rainfall is being recorded in that area or region. Earth Flow: “Earth flow landslide is composed of mixture of fine-grained soil. Fine grained soil consists of surface deposits and disrupted bedrock. Earth flow strength is low throughout much of its slide, and movement occurrence is not continues on the shear surfaces. Earth flows commonly occur on less steep slopes than rockslides.” Slope depth is in between 10% to 30%. Upper boundary of this landslide is usually irregular in the shape. Heavy rainfall or water level rise in the soil decreases the stability of this type of landslide. This type of landslide usually occurs when higher than normal rainfall is being recorded in that area or region Movement of this type of landslide is usually slow. It is between millimeters or centimeters per day range, it can also move as fast as meters per day in exceptional conditions too. Figure 3.6 describes Earth Flow Landslide in [9]. Figure 3.6 is taken from page 10 in [9]. 27 Figure 3.6 Earth Flow Landslide Debris Slide: Landslide soil is coarse grained in this slide. It moves down words as slurry. Materials found in this slide are generally a loose combination of surface deposits, rock fragments, and vegetation. Intact slab of soil and vegetation consists of the debris slides and have a tendency to move as either soil or vegetation. They are mostly found on slopes that are very steep having about 60 to 70% typical steepness that has high probability of erosion underneath. Weathering of hard rock is responsible for the formation of the residual soil 28 which acts as a breeding ground for the most of the debris slides. “As Debris Slides are shallow compare to other slide, they are sensitive to changes that are smaller and may occur over shorter times than those that affect deeper slides”. The rate at which the Debris slides move varies from meters per minute to meters per day. Figure 3.7 Debris Slide Figure 3.7 shows debris slide. [8]. Figure 3.7 is taken from page 11 in [8]. Here we can see that debris slide landslide is very steep and it can move very rapidly. Here we can notice that debris slide slope soil is not vegetable. 29 Debris Flow: Slurry which is formed by the debris flow landslide flowing downwards is made up of surface deposits, rock particles and vegetation materials. Debris flow path marks small drainage that strips vegetation. “Debris flow individual landslide move very rapidly and it can move ranging from meters per hour to meters per second”. Figure 3.8 Debris Flow Landslide Figure 3.8 shows typical debris flow landslide and it is taken from page 12 in [8]. Here we can see that debris flow landslide begin at slide of shallow mass of soil and bedrock on the left side of the figure. Debris Slides and Debris Flows: Debris slides and debris flows are too small to be depicted on a map. They are generally found on debris slide slopes represented by coalesced scars of numerous landslides. Small vegetations is usually found on these type of landslides. “Common Slop of Debris Slides and Debris Flows is 60% and thus they are 30 very steep in general.” Figure 3.9 shows debris slide and debris flow landslide found on page 12 in [8]. Figure 3.9 Debris Slide And Debris Flow Landslide Landslide Activity: “Each landslide is classified based recent activity of four categories based on the system of Keaton and DeGraff, (1996).” Active or Historic: The activity of the landslide can be classified as active or historic based on the fresh cracks and disrupted vegetation which indicates the recent activity. Dormant- Young: This landslide is relatively fresh but there is no record of historic movement. Cracks in the slide mass are generally absent. Scarps (scarp: a line of cliffs 31 formed by the faulting or fracturing of the earth's crust) may be prominent but are slightly rounded. Water pond is partly filled with water sediments but still show long rooted plants that absorbs water from the water or soil above it. Dormant- Mature: Rounded main scarp, eroded toe area and new drainage established within the slide area which was smoothened by erosion and re-vegetation indicates it is of the dormant-mature type. Dormant- Old: This Landslide is been greatly eroded. This eroded includes significant gullies or canyons cut into the landslide mass by small streams. Original head scarp when created are mostly rounded. Re- vegetation is mostly covered and matches with the outside landslide boundaries. Confidence of Interpretation: Major classification of the landslide includes definite, probable and questionable landslide. “As Landslides are mapped based on the Landforms, the confidence of identification is dependent on the distinctness of those landforms.” Confidence of Interpretation is identified according to criteria below. Definite Landslide: almost all the diagnostic landslide features are present like headwall scraps, cracks, rounded toes, well-defined topography and many more. These features are Common for all types of landslides: Definite landslide shows down slope movements. Probable Landslide: Many of the diagnostic landslide features can be observed like headwall scraps, rounded toes, well-defined benches, closed depressions, and many more. 32 In probable Landslide not all, the above features are present but some of them are present so that we can say that its confidence of interpretation is probable landslide. Questionable Landslide: One or very few features commonly associated with landslide can be observed in these landslides. For more information about each Landslide attribute refer [8] and [9]. 33 Chapter 4 IMPLEMENTATION OF LANDSLIDE HAZARDS ONLINE This chapter provides detail description of how the ESRI .shp file is converted and stored in MySQL database to use it for Landslide Hazards Online. This chapter also describes the overview of Google Maps API and in depth description of API functions that is used in Landslide Hazards Online System. 4.1 Shapefile To KML File Conversion Google Maps API requires Longitude and Latitude coordinates to display a point on Google maps. Original given Shapefile, that are used in this project, were in North American Datum of 1983. Since Google maps API and Google Earth supports KML file format, It was required to map and convert shp files of different regions to its equivalent KML file. Google Earth™ KML file map coordinates are in WGS 84. There are many tools available to convert ESRI shp file to Google Earth KML file. Map Window GIS is also Open source GIS software that supports ESRI Shp GIS File format. Shape to Earth (available: http://shape2earth.com/shp2e.aspx ) Plug-in is available that can be added in the MapWindow GIS to convert Shp file format to Google Earth KML file format. In this project I have used MapWindow GIS Shape2Earth trial version Plugin to convert shp file to KML file. Alternate options to convert Shp file to KML files is to use ArcGIS extensions Arch2Earth (available: http://arc2earth.com/default.htm) or KMLer (available: http://kmler.geoblogspot.com/ ), but these tools and software are not only expensive but they require ArcGIS 9 or higher installed in the computer workstation. 34 Some of the Free tools to convert shp file to KML files are GPSTrakemaker (available: http://www.gpstm.com/), Shape to KMLCoverter (available:http://www.reimers.dk/files/folders/google_maps/entry328.aspx ),and shp2kml 2.0: Shape-file to Google Earth (available: http://www.zonums.com/shp2kml.html ) 4.2 KML To XML File Conversion Google Earth KML file is an extension of XML file format. Here we are trying to store Longitude/ Latitude point Conversions of polygon and other Landslide polygon attribute into MySQL database. Rename the .KML file and save the file as .XML file. Reason to save file as XML is to write the java program to read the XML file and store the XML data into MySQL database using XML file reading manipulation and storing the result into MySQL database. 4.3 Storing XML File Into MySQL Database Tables XML file node structure is described as below. <Placemark> <name></name> <description></description> <Polygon> <LinearRing> <coordinates></coordinates> </LinearRing> </Polygon> </Placemark> 35 A Landslide is represented as Placemark node in XML file. The name element of placemark contains unique ID. Description element contains landslide data information like landslide type, landslide activity, landslide movement, landslide photo year, landslide probability confidence, etc. Polygon element represents the shape of the landslides. It contains coordinates element. All the series of (latitude, longitude) points are stored in coordinate element Where first and last point in the series range are same for polygon shape closeness. In this project, I have read three xml files one at a time using java program and stored all the data in database landslide and coordinate tables. 4.4 Google Maps API The Google Maps API allows Web applications developers to embed Google Maps in their own web pages with JavaScript. The API provides a number of utilities for manipulating maps the same as Google Maps© and adding content to the map using various services, allowing web application developers to create robust maps applications on their website [10]. To start developing map application, a developer must sign for a Google Maps API key [11] and provide their website URL to generate Unique Map API key for each domain. The Google Maps API is fully integrated with the Google AJAX APIs (available: http://code.google.com/apis/ajax/documentation/ ). This framework allows you to load one API key for all supported Google AJAX APIs (including Google Maps) and also provides a common namespace for each API, allowing different Google APIs to operate 36 together. If Developer decides not to use Google AJAX API framework, he/she can still use the existing namespace only for Maps API too. We used namespace only for Google Maps API and not Google AJAX API for developing this application. 4.4.1 Start Using Google Maps API 1. Include Map API script using a script tag in the webpage. 2. Create div element to hold the Map in html body. 3. Write JavaScript function to create Map Object. 4. Set the map center to specific geographic point and set other map attributes. 5. Initialize maps object from body tag onLoad event. 4.4.2 Google Maps Events JavaScript is Event Driven. Examples of the browser events are mouse click, mouse double click, mouse over, and many more. Browser listens to this event and if that particular event triggered, and if the program code has registered that event, it will call the function related to that particular event to execute it. Google Maps API maps event can be registered using GEvent namespace and calling addListener (source:Object, event:String, handler:Function)function. e.g. GEvent.addListener (map, “moveend”, function() { 37 alert("You moved your map."); }) Here, first argument is the registered object, second argument is event type and third argument is the function that needs to be called when this event triggered. Google maps event types are click, zoomend, moveend, movestart,dragend, dragstart, mouseover, mousemove, mouseout, and many more. More information related to Google Maps event can be found on Google Maps API reference Documentation (available: http://code.google.com/apis/maps/documentation/index.html). 4.4.3 Google Maps Overlays Google Maps API support Marker, Polylines, Polygons, Tiles and Info Window overlays on the map. 1. Marker: Point on the map can be displayed using marker object. Point consists of its longitude and latitude coordinates. Thus to create a point and display it on the map developer must create marker object by calling Gmarker (point) constructor. e.g. map.addOverlay (new Gmarker(point)). Argument of the Constructor is Gpoint object. Gpoint object is createad by calling GPoint (new Glatlng (lat:double,long:double)) constructor and passing its Latitude and Longitude coordinates. Markers can be made Draggable. Default marker image is Google Maps default red icon. Custom marker can be created by creating custom image to show it on the map. Thus Developers can display their own image for the marker on the map. 38 Different events can be registered for the marker by calling addListener() method, and passing marker object as the first argument, map event as the second argument, and registered function name as the third argument. 2. Polyline Lines can be drawn using the Gpolyline object on the Google maps. Gpolyline object can be created by passing point array sequence as the first argument, line color in hexadecimal numeric HTML style as the second argument and line weight thickness in pixel as the third argument. Polyline will be draws in the sequence of order in which Gpoint objects are passed in array. Gpolyline Events are click, mouseover, mouseout, endline, lineupdated, cancelline, remove, visibilitychanged. Each event needs to be registered to each Gpolyline Object to enable event triggering for the particular event on it. There are many methods associated with GPolyline object like getVertexCount(), getVertex(index), getLength(), getBounds(), insertVertex(index,latlng). 3. Polygon Polygons are same as Polyline objects except polygons are in close shape region. Polygon Object is created by calling GPolygon() constructor. First argument in the constructor is Gpoint array. Second argument is Border Line Stroke color in hexadecimal numeric code in HTML Style. Third argument is Border Line Stroke 39 Weight or thickness in pixel. Forth argument is Border line Opacity between zero and one. Zero value is transparent and one value is opaque on the map. Gpolygon Events are click, mouseover, mouseout, endline, lineupdated, cancelline, remove, visibilitychanged. Each event needs to be registered to each Gpolygon object to enable event triggering for the particular event on it. There are many methods associated with GPolygon object like getVertexCount(), getVertex(index), getArea(), getBounds(), insertVertex(index,latlng), hide(), enableEditing(), disableEditing(), enableDrawing(). 4. Ground Overlay Polygons, Markers and Polylines are useful overlays to add overlay on the Google maps but they cannot add image overlay on the map. Image overlay can be added on the map using Ground Overlays. Arguments of the Ground Overlay constructor are image source url and map bounds where that image should be overlaid on the map. In this application we have used this ground overlay to add image overlay on large zoom level. And when map zooms in to specific regions, ground overlay can be removed or hide and polygon overlay is added to the map. 4.4.4 Google Maps API Drawbacks Google Maps API is JavaScript based. Since JavaScript runs on Web Browser at client side it is little slow compare to other scripting language like PHP that runs on server side. Alternate available option is to go for Google Maps API for Flash or Google Ajax API version 3. Google Maps API for flash is using Adobe’s Flash® plug-in to display maps 40 contents dynamically and adding flash features too. Google Maps API version 3 is designed for fast load and fast response. This application is using Google Maps API version 2 and it can be migrated to version 2 or flash maps API for better map load and better response. 41 Chapter 5 RESULTS AND SNAPSHOTS In this chapter, all the screen shots and expected result output is shown along with the description of each output. 5.1 Initial Map Load Figure 5.1 Initial Map Load At Zoom Level 6 In figure 5.1, map is initially loaded at the zoom level 6 and entire California State is displayed on the map. Map’s Default view is Terrain View. User can also change the Map view to Map, Satellite or Hybrid view. 42 In Figure 5.1, Blue line indicates Landslides prone 1200 miles of Highways scattered across California, while red line indicates 120 miles of Highways scattered across California where Landslide mapping has been done. 5.2 Map At Zoom Level 8 Figure 5.2 Map At Zoom Level 8 In Figure 5.2, total of 1200 miles of Highways scattered across California is shown in blue line and mapped 187 miles highways are shown in red line. Since map is zoomed at level 8, red and blue lines are seen more clearly in figure5.2. 43 5.3 Map At Zoom Level 10 Figure 5.3 Mendocino County Landslide Corridor Image Overlay At Zoom Level 10 44 Figure 5.4 Sonoma County Landslide Corridor Image Overlay At Zoom Level 10 45 Figure 5.5 Monterey County Landslide Corridor Image Overlay At Zoom Level 10 Figure 5.3, Figure 5.4 and Figure 5.5 displays the successfully mapped three study areas of Mendocino, Sonoma and Monterey County Landslide as the image overlays on the map. 46 5.4 Landslides At Zoom Level 15 Figure 5.6 Sonoma County Landslide At Zoom Level 15 Figure 5.6 Shows Landslides at small scale zoom at zoom level 15. Here in figure landslides color is based on Landslide activity and Landslide border thickness is based on Landslide Confidence of Interpretation. Figure 4.6 also shows Landslide Legend. 47 5.5 Display Landslide Attribute When A Landslide Is Clicked Figure 5.7 Sonoma County Landslide At Zoom Level 15 With Map Info Window Figure 5.7 Shows Landslide Attributes in map info window when a particular landslide is clicked. 48 5.6 Postmile Selection On Map Figure 5.8 Postmile Endpoint Selection Showing Two Markers And Postmile Value Figure 5.8 shows landslides before highway corridor analysis button is pressed and thus landslides shown in figure are all the landslides in this region on the map. User can select two postmile end points by clicking on the map and its equivalents postmile values is displayed on the Drop down List and Text boxes. User can alternatively enter postmile endpoint limits in drop down menu and text box and equivalent marker will be mapped and drown on the map too. 49 5.7 Postmile Query Result Figure 5.9 Postmile Query Result On Map Resulted landslides are displayed on the map that fall between two postmile point boundaries. Map/report area extends approximately 1-mile from max/min lat/long limits of Postmile points. Figure 5.9 shows landslides displayed on the map between two points. 50 Figure 5.10 Landslide Result Table All the result landslides that are displayed on the map are also shown in table too. Here user can optionally mark and unmark checkbox values for landslide attribute selection on the table. 51 5.8 Postmile Result Print View Figure 5.11 Postmile Result Print View On Map 52 Figure 5.12 Postmile Result Print View In The Table User can optionally see the Result of the Postmile Search Landslide by hitting Print View button that will open new window and displays map and result table. Figure 5.11 and Figure 5.12 shows the print view result output of the system. 5.9 Result Table Sorted Output Based On Sorting Attributes Landslides that fall between the postmile limit can be sorted out in the table based on the sort order attribute. Default sort order is based on landslide area. Sorting has done in ascending order. Sorting attributes can be selected from Drop Down box. Output table can be sorted based on landslide area, activity, confidence or depth depending on user selection. 53 Figure 5.13 Landslide Result Table Output Sort Based On Activity 54 Figure 5.14 Landslide Result Table Output Sort Based On Area Figure 5.13 and Figure 5.14 show the resulted landslides that fall in the range between two postmile limit sorted by activity and area. Landslide result output can also be sorted based on the landslide depth and confidence attribute as well. 55 5.10 Testing Results Landslide Hazards Online has been tested for different test cases. This section describes results of different test cases when incorrect input value is entered in the text boxes. 5.10.1 Marker Clicked Not On Highway Figure 5.15 Error Message When Marker Is Not Near Highway Figure 5.15 shows the error screen message if the user on the map defines the postmile end point for search. If user click on the map, Marker is drawn on the map at that coordinates on the map, but if the drawn marker is not near one mile of the Highway 56 point the application will give the error message that No Route alignment found within 1 mile for point 1 or point 2. 5.10.2 Wrong Postmile Input Format Entered In The Text Box Figure 5.16 Error Message On Wrong Input Format Figure 5.16 shows the error message “No Rout Found within 1 mile” if wrong input format is giving in postmile Selection Section. 57 5.10.3 Wrong Route Number Is Given In Postmile Selection Figure 5.17 Error Message When Incorrect Route Entered In Postmile Textbox Figure 5.17 shows error message “No Landslide Found within Range ” when perticular Highways is not passing from that county. Here in this Figure 5.15 Highway 101 is not passing from Sonoma County. If no landslides are found within the entered two postmiles then the same output message is displayed as well. 58 5.10.4 So Many Landslides Found Between Two Postmile Point Range Figure 5.18 Error Message When So Many Landslides Between Two Points Range Figure 5.18 shows the error message “There are so many Landslides found within range Narrow down Search Criteria” when there are more than 250 landslides found within two postmile point range. 59 Chapter 6 CONCLUSION AND FUTURE EXPANSION 6.1 Conclusion Google Maps API is Open Source API and it provides creation of Custom maps application. Using the Google MAPS API, many Geographic Map Applications can be built. It is simple to learn and it is programming language independent. It has been implemented in JavaScript that runs on Client side. GIS applications developed using Google Maps API is simple to use and adopt. Google Maps user interface is very simple and easy to learn. Developers can also create their own custom user interface (UI) features using MAPS API depending on the client requirements. This tool will allow engineers, geologists and planners to identify landslides that impact a particular highway area or region. The web-based system also has the capability to generate reports summarizing landslide information in tables and map, based on different user defined criteria. Thus, Geologist does not need to look for the whole report and analyze it manually. It also eliminates the need for expensive GIS license software. Using the Google Maps API Geo planner can actually get the detail idea about the location, environments and surroundings of the Landslides and can see the actual highway road side curvatures which was not on the original given GIS shp file. Using this tool, user can see the Landslide prone California Highways indicated by red and green lines on Google Maps at higher zoom level. When user further zooms in, three different county study areas out of seven different study areas displayed as the 60 semitransparent image on top of the Google maps to get the general idea about the exact location of the landslides region. When user further zooms in above 15 Google maps zoom level and if the landslides fall within current map view boundaries, landslides data is fetched from the MySQL database and Landslides polygon are displayed on Google Maps. Detail Information about the Landslide can be viewed by clicking on particular Landslide on the map. Geo Planner can actually analyze the Landslides based on the Landslide attributes between specific boundaries too. Print View functionality displays list of Landslides on the map as well as in the table format too. From this Project, I gained valuable experience with Google Maps API, MySQL database, PHP and Javascript, Java, and XML technologies. 6.2 Future Expansion At present this tool has Sonoma, Monterey, and Mendocino county database. Remaining four counties of the originally identified 187 miles of Corridors needs to be converted and mapped in this tool; additionally there is a total of 1200 miles of Landslide prone California Highway Corridors that can be mapped in this tool and database. The tool can be extended to have photo place mark layer of the actual landslide like webcams, wikipedia or videos layer in Google maps. Thus when Photo Place mark layer is selected all the photo thumbnails of the landslide can be shown at its original landmark coordinates. And when a user clicks on that photo thumbnail, new window can be opened that will display landslide photo image of the actual site where it occurred. 61 This web-based tool may be integrated with other CalTrans Geotech web-based systems “Shake Cast” and “ARS Online”. These Web-based Tools are already implemented using Google Maps API. 62 APPENDIX A Map Load landslide_index.php is the main page that loads the Google map and this page is used for zoom in, map click and map drag functionality. Here in this appendix map zoom end function is described. Map movend and mapclicked are also registered in the map and these functions are called when map is dragged or map is clicked. moveend and mapclicked functions work the same way as map zoomend. mapclick fuction is used to create the marker on the map. First it draws marker on the map where the map is clicked. Second, it will call the postmile proxy web services to find the postmile location associated with that marker. Third, it will call the postmileresultquery.php page when the user enters two postmile limits. Postmilephpresultquery.php returns all the landslides that fall in the user selected area. Forth, map click function loads all landslides on the map returned by postmileresultquery.php webpage. function load() { zoomtype=0; var onetimeonly=0; var zoomlevel=6; var mapcenterlat=0.0; var mapcenterlng=0.0; if (GBrowserIsCompatible()) { //Create the Google map object by passing div element “map” in the function map = new GMap2(document.getElementById("map")); //set the map center 63 var mapcenter=new GLatLng(37.35269280367273, -120.47607421875); var polygon=null; postmilesearchflage=0; //set map object center and intitial zoomlevel map.setCenter(mapcenter,zoomlevel); map.setZoom(zoomlevel); //set the initial map load type to Terrain view map.addMapType(G_PHYSICAL_MAP); map.addControl(new GScaleControl()); map.addControl(new GMapTypeControl()); //add zoom in, zoom out, map move left , move right and zoom in scale in the map map.addControl(new GLargeMapControl()); /*register zoom end event by passing map as the first argument, zoomend event as the second argument and function that needs to be called when zoom end event is triggered */ /* zoom end function starts here */ GEvent.addListener(map,"zoomend",function(){ tempmarkercount=0; n=0; if(postmilesearchflage==0 && zoomtype==0){ if(map.getZoom()>14){ zoomload=1; /*display progress bar while landslides polygon is retrieved from the MySQL Database by calling the progressbar javascript. Stop the progress bar when all the polygons are loaded on the map.*/ progressBar.start(); /*Hide all the image overlay if zoom level is above 14 and load polygons after zoom level 14. Since there are total more than 4000 polygons in the MySQL and each polygon contains atleast on average 50 points it would be difficult to draw polygons at map higher scale level. So between map zoom level 6 to 14 landslide corridor hazards are displayed as the image overlay. Hide the image overlay when map zoom level is more than 14. Hide Sonoma, Monterey and Mendocino counties image overlays.*/ 64 sonoma_groundoverlay.hide(); sonoma_groundoverlay_2.hide(); mendocino_groundoverlay.hide(); monterey_groundoverlay_1.hide(); monterey_groundoverlay_2.hide(); /*every time when map is zoomed retrieve the polygons from the MySQL that fall within map bounds . and remove all the previous polygon and marker overlays .*/ for (var a = 0; a < tempmarker.length; a++) { map.removeOverlay(tempmarker[a]); } //create the xmlhttpt request to retrieve the polygon records from the mysql. var request_zoomend = GXmlHttp.create(); var bounds = map.getBounds(); var southWest = bounds.getSouthWest(); var northEast = bounds.getNorthEast(); var getVars2 = 'ne=' + northEast.toUrlValue()+ '&sw=' +southWest.toUrlValue(); request_zoomend.open('GET', 'phpresultquery.php?zoom='+map.getZoom()+'&'+getVars2, true); request_zoomend.onreadystatechange = function() { /*if polygon records are successfully retrieved and httprequest is successfully served than its ready state parameter value will be 4 and status parameter is 200.*/ if (request_zoomend.readyState == 4 && request_zoomend.status==200) { var xml = request_zoomend.responseXML; var polygones = xml.documentElement.getElementsByTagName("polygone"); var temppolygone = polygones; for (var a = 0; a < polygones.length; a++) { var skip=0; var color = polygones[a].getAttribute("colour"); 65 var width = parseFloat(polygones[a].getAttribute("width")); var confidence = polygones[a].getAttribute("confidence"); var activity=polygones[a].getAttribute("activity"); var init_mov=polygones[a].getAttribute("init_mov"); if(activity=='H' || activity=='A' ){ color = "#954C2C"; } else if(activity=='Y' ){ color="#C27B2B"; } else if (activity=='M'){ color="#F1D550"; } else if (activity=='O'){ color="#E0DEB5" } var polygonid= polygones[a].getAttribute("id"); if((polygonid>=1 && polygonid<=2215)||polygonid>4209){ var fullreport="monteray5"; } else if(polygonid>=2216 && polygonid<=2833){ var fullreport="mendocino1"; } else if (polygonid>=2834 && polygonid<=4209){ var fullreport="sonoma4"; } var html = "<iframe FRAMEBORDER=0 width=230 height=100 66 /*retrieve all the landslide polygone records out from dynamic xml file created by phpresultquery.php page one at a time in the loop from the xmlhttpresonse and and append iframe with each landslide polygon. When user clicks on particular landslide polygon it will display all the attributes associated with that particular landslide.*/ src='tablepolyinfo.php?id="+polygones[a].getAttribute("id")+"&activity="+polygones[a].getAttribute("acti vity")+"&init_mov="+polygones[a].getAttribute("init_mov")+"&confidence="+polygones[a].getAttribute(" confidence")+"&depth="+polygones[a].getAttribute("depth")+"&dir_mvmnt="+polygones[a].getAttribute( "dir_mvmnt")+"&photo_yr="+polygones[a].getAttribute("photo_yr")+"&area="+polygones[a].getAttribut e("area")+"&acres="+polygones[a].getAttribute("acres")+"&perimeter="+polygones[a].getAttribute("peri meter")+"&prime_geol="+polygones[a].getAttribute("prime_geol")+"&prime_lith="+polygones[a].getAttri bute("prime_lith")+"&sec_geo="+polygones[a].getAttribute("sec_geo")+"&sec_lith="+polygones[a].getAtt ribute("sec_lith")+"&geostrike="+polygones[a].getAttribute("geostrike")+"&geo_dip="+polygones[a].getA ttribute("geo_dip")+"&fullreport="+fullreport+"&comment="+polygones[a].getAttribute("comment")+" '> </iframe>"; /*retrieve all the coordinates associated with the particular landslide from the dynamically created xml file from phpresultquery.php file. */ var points = polygones[a].getElementsByTagName("point"); var pts = []; var totalpoints=points.length; for (var i = 0; i < points.length; i++) { pts[i] = new GLatLng(parseFloat(points[i].getAttribute("lat")),parseFloat(points[i].getAttribute("lng"))); } pts[points.length]=new GLatLng(parseFloat(points[0].getAttribute("lat")),parseFloat(points[0].getAttribute("lng"))); var poly = createPolygone(pts,color,width,html,confidence); tempmarker[n++]=poly; map.addOverlay(poly); } } } request_zoomend.send(null); /*stop progress bar script as all the records of the landslides are loaed on the map at this point*/ 67 setTimeout("progressBar.remove();",4000); /*dynamic loading of landslide from mysql database and dynamic response code ends here*/ } /* if map zoom level is less than 9 than load the landslide as an image overlay on the map. Since map is on large scale at this zoom level, just draw blue and red lines starting and end point of the landslides highway roads to give overall idea about the location of the landslides. Image can be overlaid on the maps by passing north east and south west coordinates points. */ else if(map.getZoom()<=9){ whole_map.show(); if(mendocino_groundoverlay!=null){ mendocino_groundoverlay.hide(); } if(sonoma_groundoverlay!=null){ sonoma_groundoverlay.hide(); } if(sonoma_groundoverlay_2!=null){ sonoma_groundoverlay_2.hide(); } if(monterey_groundoverlay_1!=null){ monterey_groundoverlay_1.hide(); } if(monterey_groundoverlay_2!=null){ monterey_groundoverlay_2.hide(); } } else if(map.getZoom()>9 && map.getZoom()<=14){ /* display landslide of each county as an image overlay of one mile wide polyone.*/ whole_map.hide(); if(onetimeonly==0){ 68 progressBar.start(); /*coordinates of the 187 miles of California state landslide prone highways that has been successfully mapped and entire 1200 miles of California state landslide zone highways . */ var postmile_187bounds=new GLatLngBounds(new GLatLng(33.93278,124.198056),new GLatLng(41.763179,-116.998352)); postmile_187miles_overlay= new GGroundOverlay("images/map_images/county_postmile/187 miles landslide corridors copy.png", postmile_187bounds); map.addOverlay(postmile_187miles_overlay); var mendocino_bounds=new GLatLngBounds(new GLatLng(39.8403147734,123.7973010553),new GLatLng(39.9459691757, -123.6943880482)); mendocino_groundoverlay= new GGroundOverlay("images/map_images/MEN_1_transperent_bg.png", mendocino_bounds); map.addOverlay(mendocino_groundoverlay); var sonoma_bounds=new GLatLngBounds(new GLatLng(38.436728796, 123.3009886893),new GLatLng(38.5761662745,-123.093847088)); sonoma_groundoverlay= new GGroundOverlay("images/map_images/county_polygon/SON_1_transperent_bg1.png", sonoma_bounds); map.addOverlay(sonoma_groundoverlay); var sonoma_bounds_2=new GLatLngBounds(new GLatLng(38.3049886745,123.1285670692),new GLatLng(38.4450286932, -123.0153905481)); sonoma_groundoverlay_2= new GGroundOverlay("images/map_images/county_polygon/SON_2_transperent_bg2.png", sonoma_bounds_2); map.addOverlay(sonoma_groundoverlay_2); //var monterey_bounds_1=new GLatLngBounds(new GLatLng(36.1530243181,121.9368344486),new GLatLng(36.5023661854, -121.6507847411)); var monterey_bounds_1=new GLatLngBounds(new GLatLng(36.1540243181,121.9378344486),new GLatLng(36.5033661854, -121.6517847411)); monterey_groundoverlay_1= new GGroundOverlay("images/map_images/county_polygon/MON_1_transperent_bg.png", monterey_bounds_1); map.addOverlay(monterey_groundoverlay_1); 69 var monterey_bounds_2=new GLatLngBounds(new GLatLng(35.7596531999,121.6503745568),new GLatLng(36.1391658471, -121.2996140497)); monterey_groundoverlay_2= new GGroundOverlay("images/map_images/county_polygon/MON_2_transperent_bg.png", monterey_bounds_2); map.addOverlay(monterey_groundoverlay_2); //map.addOverlay(new GMarker(new GLatLng(38.3049886745,123.1280670692))); //map.addOverlay(new GMarker(new GLatLng(38.4450286932, 123.0153905481))); setTimeout("progressBar.remove();",4000); onetimeonly=1; } postmile_187miles_overlay.show(); sonoma_groundoverlay.show(); mendocino_groundoverlay.show(); sonoma_groundoverlay_2.show(); monterey_groundoverlay_1.show(); monterey_groundoverlay_2.show(); } } /*zoom end function ends here*/ }); //load functions ends } 70 APPENDIX B Phpresultquery Phpresutlquery.php retries the result from the mySQL database and returns the resulted polygon point coordinates and polygons that fall between map boundaries. Similarly Landslide found between the two postmile criteria can be retrieved postmilerequestquery.php whose functionality is same as phpresultquery.php. <?php //echo $_GET['zoom']; $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = ''; /* mysql database connection request.first paramereter is host database server, second parameter is database user name and third parameter Is database user password.*/ $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql'); // connection establisted"; $dbname = 'landslide'; mysql_select_db($dbname); /* retrieve the xmlhttprequest parameters requested by landslide_index.php page retrieving data from the get request of lat and long cordinate of the boundry.*/ list($nelat,$nelng) = explode(',',$_GET['ne']); list($swlat,$swlng) = explode(',',$_GET['sw']); //covert the retrieved parameter to its appropriate variable type $nelng=(float)$nelng; $swlng=(float)$swlng; $nelat=(float)$nelat; $swlat=(float)$swlat; in 71 /*retrieve all the landslides id from the mysql database that fall between map north east and south west bounds*/ $sql = "SELECT distinct(id) FROM landslide_mendocino.coordinate WHERE (abs(lng) >= abs($nelng) AND abs(lng) <= abs($swlng)) AND (lat <= $nelat AND lat>= $swlat) ORDER BY id desc"; set_time_limit (3000); $list = array(); $result=mysql_query($sql,$conn); for($row=0;$row<mysql_num_rows($result);$row++){ $resultid= mysql_result($result, $row, "id"); /*retrieve all the attributes associated with each landslide id*/ $sql2="Select * FROM landslide_mendocino.coordinate where id=$resultid order by count ASC"; $result2=mysql_query($sql2,$conn); $sql3="SELECT * FROM landslide_mendocino.landslidetest WHERE id=$resultid"; $result3=mysql_query($sql3,$conn); $polygoneid=mysql_result($result3,0,"id"); $activity=mysql_result($result3,0,"activity"); $init_mov=mysql_result($result3,0,"init_mov"); $confidence=mysql_result($result3,0,"confidence"); $depth=mysql_result($result3,0,"depth"); $dir_mvmnt=mysql_result($result3,0,"dir_mvmnt"); 72 $photo_yr=mysql_result($result3,0,"photo_yr"); $area=mysql_result($result3,0,"area"); $acres=mysql_result($result3,0,"acres"); $perimeter=mysql_result($result3,0,"perimeter"); $comment=mysql_result($result3,0,"comment"); $prime_geol= mysql_result($result3,0,"prime_geol"); $prime_lith = mysql_result($result3,0,"prime_lith"); $sec_geo = mysql_result($result3,0,"sec_geo"); $sec_lith = mysql_result($result3,0,"sec_lith"); $geostrike = mysql_result($result3,0,"geostrike"); $geo_dip = mysql_result($result3,0,"geo_dip"); $list[] = "<polygone colour=\"#FF0000\" width=\"4\" id=\"$polygoneid\" activity= \"$activity\" init_mov=\"$init_mov\" confidence=\"$confidence\" depth=\"$depth\" dir_mvmnt=\"$dir_mvmnt\" photo_yr=\"$photo_yr\" area=\"$area\" acres=\"$acres\" perimeter=\"$perimeter\" comment=\"$comment\" prime_geol=\"$prime_geol\" prime_lith= \"$prime_lith\" sec_geo= \"$sec_geo\" sec_lith= \"$sec_lith\" geostrike= \"$geostrike\" geo_dip= \"$geo_dip\" >"; /* retrieve the coordinate point of the landslide*/ for($p=0;$p<mysql_num_rows($result2);$p++) { $lat= mysql_result($result2,$p,"lat"); $lng=mysql_result($result2,$p,"lng"); $id=mysql_result($result2,$p,"id"); $list[] ="<point lat=\"$lat\" lng=\"$lng\" id=\"$id\" />"; } $list[] ="</polygone>"; } header('content-type:text/xml;'); //create xml file that will return the record to landslide_index.php web page. echo "<markers>"; 73 echo join("\n\t",$list)."\n"; echo "</markers>"; ?> 74 BIBLIOGRAPHY [1] GIS.com. GIS Introduction. “ What is GIS ? ” [Online]. Avalable : http://www.gis.com/whatisgis/index.html [2] ESRI Shape Technical Description pp 1. (1998,July) An ESRI white Paper [online]. Available: http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf [3] PHP Group (2009, Nov) “PHP Manual ”PHP.net [Online].Available: http://us2.php.net/manual/en/intro-whatis.php [4] PHP Group (2009, Nov) “PHP A simple tutorial Manual.” PHP.net [Online].Available: http://us2.php.net/manual/en/tutorial.php [5] W3schools.com “JavaScript Tutorial” [Online]. Available: http://www.w3schools.com/JS/js_intro.asp [6] PHP Group (2009, Nov) “PHP Manual. Client URL Library, cURL” PHP.net [Online].Available: http://us3.php.net/manual/en/intro.curl.php [7] Dictionary.com “Scarp Definition,” [Online]. Available: http://dictionary.reference.com/browse/scarp?db=dictionary [8] M.W.Manson, C.W.Davenport, C.J.Dmrose and C.J. Wills. Department of conservation, California Geological Survey. (2003). “Special report 187. Landslides in the highway 101 corridor between Leggett and Piercy, Mendocino county, California” prepared for California Department of Transportation, Office of Infrastructure Research. pp-9-14. [Online]. Available: http://www.dot.ca.gov/hq/research/researchreports/reports/2006/corridor/appendix_b. pdf 75 [9] M.W.Manson, C.M.Huyette, C.J.Dmrose and C.J. Wills. M.E. Huffman, M.G. Smelser, M.E. Fuller,C. Domrose and C. Gutierrez Department of conservation, California Geological Survey. (2006). “Special report 196. Landslides in the highway 101 corridor between Bodega Bay and Fort Ross, Sonoma County, California” prepared for California Department of Transportation, Office of Infrastructure Research. pp-7-15. [Online]. Available: http://www.dot.ca.gov/hq/research/researchreports/reports/2006/corridor/appendix_d. pdf [10] Google Code. Google Maps API. “What is Google Maps API?” [Online]. Available: http://code.google.com/apis/maps/ [11] Google Code. Google Maps API. “Sign up for Map API key.” [Online].Available: http://code.google.com/apis/maps/signup.html