Visualization Method of Trajectory Data Based on GML, KML Junhuai Li, Jinqin Wang, Lei Yu, Rui Qi, and Jing Zhang School of Computer Science & Engineering, Xi'an University of Technology, Xi'an 710048, China {lijunhuai,wangjq,yulie,zhangjing}@xaut.edu.cn Abstract. With the advantages of GML and KML, we propose a new method of visualization of trajectory data. To achieve the integration and sharing of geographic data of different sources and different formats, XSLT and XPath technologies are utilized firstly to convert the original trajectory data to GML format for storage and transmission. And then GML is converted to KML to achieve the rapid visualization of trajectory data in browser. Finally, using KML files, the trajectory data can be visualized rapidly in Google Maps and Google Earth. Keywords: Visualization of trajectory, GML, KML. 1 Introduction Attribute to the rapid development of geographic information technology and the increasingly sophisticated of mobile communication technologies, the implementations of GIS have become more and more diversified, e.g., GIS, Web GIS, Mobile GIS. Simultaneously Meanwhile, with the development of positioning technology and the update of mobile devices, it is very easy to gather a variety of location information quickly, and store the collected trajectory data into database or file. Actually, the trajectory records the individual s activities in the real world, which to some extent will reflect the individual s intentions, preferences and behavior patterns [1, 2]. People can get their location information by using some mobile devices along with a certain kind of positioning method. Then through the visualization of the location information, they can analyze their own activities and moving trajectories [3]. E.g., to manage and schedule the vehicles effectively, GIS has connected the trajectories data together in the order of time to form the moving trajectories of vehicles; Travel enthusiasts can associate their trajectories with the photographs taken during the travel to memory the journey, and also can share the travel experiences with friends. 2 Related Works GML provides a kind of open standard for the GIS field in the network era, its starting point is the encoding of spatial data (including distributed spatial data D. Jin and S. Lin (Eds.): Advances in CSIE, Vol. 2, AISC 169, pp. 479 484. springerlink.com Springer-Verlag Berlin Heidelberg 2012
480 J. Li et al. encoding); As the wide application of XML encoding in various fields, which further involves the integration coding of the spatial data and non-spatial data: The applications of XML in description of style (such as XSL), 2D graphics (such as SVG), voice ( such as Voice XML) fields etc. have made GML to provide basis for the reasonable performance of spatial data; The many advantages of GML have laid the foundation for the interoperability of heterogeneous GIS invisibly [4]. As more and more organizations and software developers use XML/GML as the criterion of spatial data representation, transmission, storage, the unification of spatial data encoding and data interoperability and sharing will eventually become realities, and thus truly realize the open access to spatial information. Currently, there are three methods to parse GML files [5]. The first one is based on the visualization strategy of raster image. In this strategy, the client user sends GML map request to the Web server, Web server accepts the request and call the GML map service program to handle user s request, and finally sends the got raster map (GIF or JPG format) to the client display in a static page form. The second one is component-based visualization strategy. In this strategy, Web server does not handle all of the user s requests, but sends the client GML data and GML data processing components( such as Java applet, ActiveX components or Plug-in) through Web server, users can operate the requested GML data in client through the component, these operations including map window, zoom, roam, and information inquiries, etc. The third one is SVG-based visualization strategy. SVG (Scalable Vector Graphics, Scalable Vector Graphics Markup Language) is an open 2-dimensional vector graphics format, as the same as Mathematical Markup Language (MathML), it is an application of Extensible Markup Language XML. SVG features include nested transformations, clipping paths, transparency processing, filter effects, and other extensions. Meanwhile, SVG supports animation and interaction, and also supports the holistic XML-DOM interfaces [6]. SVG can be embedded in other XML documents, and SVG documents can also be embedded by other XML content, the various SVG graphics can be easily combined to form new SVG graphic, thereby stepping forward a big step on the graphical reusability. The above three typical GML visualization methods have their own advantages and disadvantages. SVG-based visualization strategy has great improvements compared to the former two visualization strategies. First, compared to the component-based strategy, as the same it needs to request data only once, but the map operation can be done on the client. Meanwhile, the strategy does not need a special component design for the client, so that its requirements to client are very low, as the same as the strategy based on raster image. But different from the strategy based on raster image, it does not need to complete the operation of the map through the server. SVG-based visualization strategy has its own disadvantages, i.e., SVG does not support the topology, geographic coordinate systems and 3D data, which greatly increased its limitations. 3 Trajectory Data Visualization Model GML is a recognized as the intermediary-convert file by most GIS software. Through converting the trajectory data collected from devices in different locations into a
Visualization Method of Trajectory Data Based on GML, KML 481 GML file, we can carry on a variety of selective visualizations, such as converting GML format file into KML to visualize. In order to visualize trajectory data from various sources, formats and data models in GIS rapidly, this paper proposed a trajectory data visualization model (TD- Visual Model)combining the advantages of GML and KML. Firstly, converting trajectory data in different formats into a unified GML file to achieve the integration and sharing of heterogeneous data. And then, utilize the XSLT technology to generate KML file from GML file. Visualization of trajectory data can be achieved based on the advantages of the KML visualization finally. In the model, when a client sends a request to the Web server, Web server accepts the request and converts the trajectory data that queried from the database into GML file; then convert GML file into KML file through XSLT, and finally it will be presented to the user through the Google Earth or Google Map. The structure of TD- Visual model is shown in Fig. 1. The achievement of TD-Visual model mainly consists of five steps: GML Schema modeling, trajectory data conversion, the establishment of XSLT template, the conversion from GML to KML and trajectory data visualization. (1) GML Schema Modeling GML consists of three basic XML Schemata, namely feature.xsd, geometry.xsd and xlink.xsd. Feature.xsd defines an abstract model of geographical features; geometry.xsd defines the information of specific geometry; and xlink.xsd defines various function links [4]. Geographic data is stored based on the layer; each layer is composed of point, line, and surface. Therefore, a layer model is necessary when storing the trajectory data. According to the criterion of UML diagrams and GML, this paper established a GML Schema mode which conformed to the trajectory data after conversion (2) Trajectory Data to GML In order to achieve the conversion from trajectory data to GML, a schema must be obeyed as for the operations of trajectory data DBMS and the middle layer data. There are three ways to convert trajectory data to GML documents in.net: The first is to use push model SAX (Simple API for XML); the second is to use DOM (Document Object Model); the third is to use flow model XMLTextReader class and XMLTextWriter. Taking the efficiency into account, this paper adopted the third method which is a flow model to parse GML document. When using C# to generate GML document, it will use XMLTextWriter class, and WriteStartDocument (), WriteStartElement (), WriteAttributeString (), WriteElementString (), WriteEndDocument () etc. methods in the class. It can be easily observed in Fig. 1 that the trajectory data from the database is firstly stored, then an instance of XMLTextWriter class is created, and finally GML documents are generated based on the Schema specification as well as the properties and methods of XMLTextWriter class.
482 J. Li et al. Fig. 1. TD-Visual Model (3) The Conversion from GML to KML The conversion from GML to KML is the most important part in trajectory data model. As both GML and KML are based on XML, we use XSLT as the data conversion technology [5]. During the conversion process, the following technologies will be utilized: Xpath Quick Search technology which can quickly retrieve the nodes that need matching; create an XSLT style sheet, which defines the matching style of each node and the target document s style; XSLT Processor means XSLT parser, through which converting GML to KML can be achieved. (4) Trajectory Data Visualization KML is mainly used to describe the marks, such as the positioning mark, commercial label, etc. The converted KML file can be loaded directly from Google Earth to achieve KML visualization, but in order to achieve KML visualization by calling JavaScript, the KML must be imbedded in a Web site [6]. To visualize the trajectory data in KML file, points and lines must be visualized. The KML file that contains a <kml> label, a <Document> label named Paths, which describes the properties of line that after visualization, and a <Placemark> label named Absolute Extruded. When the file is read by Google Earth client, <Placemark> will display the latitude and longitude specified by <coordinates> according to the properties described in <Document>.
Visualization Method of Trajectory Data Based on GML, KML 483 4 Trajectory Data Visualization Platform Based on the abovementioned methods, this paper develops a trajectory data visualization platform, which can be divided into three-tier structure: the data access layer, the business logic layer and the presentation layer. 4.1 Application Model Figure 2 describes the major class model of business logic layer. A series of point objects are the main elements of a trajectory principal. Each trajectory instance is accompanied with a corresponding Object ID and Trajectory ID. Fig. 2. Business logic object class Fig. 3. Business logic layer class A Map Box instance is used as a parameter of Query instance. Two point objects are used to model the corner coordinates of a space form, representing the top right corner and bottom left corner of the form. Time Point principal demonstrates a specific time stamp, which is composed of several elements including year, month, day, hour, etc. Similarly, two Time Point instances are used to model a Temporal Map, representing the start time and end time of an interval. This Temporal Map instance is utilized as the parameter of Query instance. A Query instance represents an actual query, and will be sent to the database after conversion. The corresponding element indicates the actual value of the query, and the query type will be instanced to a Query Type. Business logic layer owns a range of entities, as shown in Figure 3. The figure contains the modification of object state that the administrator can get all of the methods by changing some of the states in this layer. Parser class is used to provide a validation and extraction of the value of GML query file. It converts GML query file into SQL statements, and constitutes a Query instance through Query Manager Entities. Finally, a trajectory instance can be converted into a GML/KML format file by the Trajectory Manager. 4.2 System Implementation Based on the trajectory visualization platform, we can record the trajectories of vehicles according to the GPS data and query the trajectories of each vehicle as well
484 J. Li et al. as the detailed information in the map. We will get corresponding GML file, KML file and map display by visualizing the queried trajectory data. Figure 4 shows the parsed trajectory in Google Map and Figure 5 presents the driving route parsed by KML in the Google Map. Fig. 4. The vehicle trajectory search function Fig. 5. KML file parsed in Google Earth 5 Conclusion The trajectory data visualization has been proved to be a promising technology and has attracted great attention. As the development of positioning technologies and the constant update of communication equipment, the storage formats of collected trajectory data will be more and more diversified. This paper has investigated the visualization of trajectory data from various sources and formats, and future work will mainly focus on the trajectory data sharing and integration, visualization of trajectory data in multi-platforms and trajectory data mining. Acknowledgments. This work was supported by a grant from the Natural Science Foundation of China (No. 61172018), the Science & Research Plan Project of Shaanxi Province (No. 2011NXC01-12) and Science & Research Plan Project of Shaanxi Province Department of Education (No.2010JC15). The authors are grateful for the anonymous reviewers who made constructive comments. References 1. Yu, Z., Xing, X.: Enable Smart Location-Based Services by Mining User Trajectories. Communication of CCF 6(06), 23 30 (2010) 2. Kritzler, M., Raubal, M., et al.: A GIS Framework for Spatio-temporal Analysis and Visualization of Laboratory Mice Tracking Data. Transactions in GIS 11(5), 765 782 (2007) 3. Buliung, R.N., Kanaroglou, P.S.: A GIS toolkit for exploring geographies of household activity/travel behavior. Journal of Transport Geography 14(1), 35 51 (2006) 4. Open GIS Consortium: Geography Markup Language (GML) 1.0, http://www.opengis.org 5. Gkoutsidis, I.S.: Trajectory Data Visualization: The VisualHERMES Tool. MSc THESIS, ME/0567 (2008) 6. Wang, Z., Zhang, Y., Ren, J.: On the KML Markup Language Specifications and Their Exchange with GML. Standardization of Surveying and Mapping 26(1), 10 13 (2010)