|
The article “DIY GIS” in the June 2008 issue of Public Works Magazine featured the Google Earth application that I developed as an innovative way of delivering Geospatial data to local governments. With this tool, the City of Pataskala was freed from expensive investment of in-house GIS infrastructure. As an engineering consulting firm, software applications are generally considered as tools that we have to develop to get the job done. It is an expense to the business rather than something that is profitable. As a result, we apply quite some quick and dirty tricks in our applications. Things that are unique about this application are:
- It is a desktop application developed using HTML/XML/JavaScript without a web server
- GIS data is stored in a single KMZ file, including the photos
- XML is used as the database, and XSLT is used for query
BackgroundThe City of Pataskala MS4 outfall mapping project was a point data collection project. We set up an in-house Microsoft Access application that can switch between a table view and the form view to edit the data collected from the field. ArcGIS was used to process the points and make maps. Everything worked fine in the office, but as we started to work in the field we found we had trouble of getting mapping information because we do not have access to ArcGIS. Then we found Google Earth was very handy, it would be great if we can have our own data in it. As the project progressed, I first imported the outfall layer in Google Earth and later built a web page that can query the outfall data within Google Earth. Converting tables with x, y coordinates into KML is a fairly easy task and can be quickly done in Microsoft Access. The challenge is making a desktop application using Google Earth that can do search and fly to point without a server.
Interacting with Google Earth Before the Google Earth Plugin was available, the preferred way of interacting with Google Earth was through a KML file with a NetworkLink tag in it. Google Earth listens to the NetworkLink, allowing the web application to instruct Google Earth to move its camera or load new data. The licensing cost of using a web based solution such as Google Maps or the Google Earth Plugin was simply too high for an application used by only a few people. So the web server based solution was quickly ruled out. Fortunately, someone in the community worked out a way to hack Google Earth in Internet Explorer through ActiveX using its COM API. This was originally documented by Nitoyon but has since been documented by Google (see: http://www.earth.google.com/comapi/ ). This allows Google Earth to be manipulated using JavaScript. Add the code below to an HTML file then Google Earth can be called to fly to the specified latitude,longitude coordinate. The downside is that the HTML file can only run locally due to security restrictions. But this does not affect my application. ERROR [include_code_listing plugin]: File Not Found (/usr/www/users/winwaed/geowebguru/img/2009/melmeng_code.html)
Search the dataHow to search the data using a web page without a database? At that time, I knew nothing about AJAX frameworks and I picked the hard way to get the job done: using XML as the database, and using XSLT to do the search. To my surprise, for a database with around 3000 records it runs smoothly. However, for most tasks XML/XSLT is way too complicated to work with. After I learned JSON, I knew I would never use XML again if at all possible.
Conclusion
Developing a desktop application using JavaScript/XML without a web server sounds like a dumb idea. However, as Google Earth is such a great tool that connects us to huge amount of spatial information, this unusual approach turns a dumb idea into a powerful application for viewing fairly large datasets locally without installing any new software.
About the AuthorMel Yuanhang Meng is the CAD/GIS Manager for DLZ Ohio. He works in the field of water/wastewater infrastructure design, maintenance and modeling. His professional interests include asset management, field data collection and web based GIS application development. He holds a MA degree in Geography and a MS degree in Environmental Engineering, both from the University of Cincinnati.
|