CGI approach to developing a geographic virtual reality toolkit on the Internet

CGI approach to developing a geographic virtual reality toolkit on the Internet

Computers & Geosciences 28 (2002) 13–19 A Java/CGI approach to developing a geographic virtual reality toolkit on the Internet$ Bo Huanga,b,*, Hui Li...

484KB Sizes 0 Downloads 73 Views

Computers & Geosciences 28 (2002) 13–19

A Java/CGI approach to developing a geographic virtual reality toolkit on the Internet$ Bo Huanga,b,*, Hui Lina a

Department of Geography and Joint Laboratory for GeoInformation Science, The Chinese University of Hong Kong, Shatin, N. T., Hong Kong b National Laboratory of Resources and Environment Information System (LREIS), Chinese Academy of Sciences, Beijing, People’s Republic of China Received 23 October 1999; received in revised form 11 September 2000; accepted 20 September 2000

Abstract A Java/common gateway interface (CGI) approach is employed to design a toolkit for interactively building up virtual environments from existing geographical information system (GIS) databases. This approach takes advantage of both the Java and CGI approaches, providing a flexible and user friendly interface, while making better use of the power of the server. It is also beneficial to the balancing of workloads on both client and server sides. A prototype, called GeoVR, has been implemented by extending ArcView Internet Map Server on its client side by the Java language and correspondingly, on its server-side by the Avenue language. The GeoVR server is responsible for generating 3D scenes in terms of parameter values sent from the Java client. The 3D scenes are then transformed to VRML models, and delivered to the WWW browser for display and navigation. This toolkit, allowing users to interact with 2D GIS data on the Internet and create perspective views from these data on the fly, illustrates how to extend an existing Internet GIS into a more powerful virtual GIS. # 2002 Elsevier Science Ltd. All rights reserved. Keywords: Geographical information system; Virtual reality; Virtual reality modeling language; Internet; GeoVR

1. Introduction There has been an increased interest in the exploration of virtual environments (Gahegan, 1998; MacEachren et al., 1999) for a wide range of applications such as environmental planning and management (Bishop and Gimblett, 2000), urban planning and design (Doyle et al., 1998; Counsell, 1999), landscape visualization,1 and education and training (Unwin, 1997; Dykes et al., $

Code available from server at http://www.iamg.org/ CGEditor/index.htm. *Corresponding author. Current address: Department of Computer Science, Keele University, Keele ST5 5BG, UK. Fax: +44-01782-713082. E-mail addresses: [email protected] (B. Huang), [email protected] (H. Lin). 1 [http://www.clr.toronto.edu/IMAGELIB/CLRwork/clr. html].

1999). Among these applications, virtual reality (VR) technology offers new and exciting opportunities for users to interact visually with and explore 3D geo-data. With the rise of VR applications, a number of toolkits related to geographic VR or the linkage of geographical information system (GIS) and VR have been developed. These toolkits are generally divided into two categories: (a) creation of 3D models represented by virtual reality modeling language (VRML) from GIS or CAD data; and (b) interaction with the VRML worlds such as querying spatial objects. In category (a), Pavan2 and VirtualGIS3 are two typical examples. Pavan, a VRML compiler and project management system for the GIS, MapInfo, can create complete VR worlds, with navigable 3D models generated from data held in MapInfo. 2 3

[http://www.pavan.co.uk]. [http://www.erdas.com].

0098-3004/02/$ - see front matter # 2002 Elsevier Science Ltd. All rights reserved. PII: S 0 0 9 8 - 3 0 0 4 ( 0 1 ) 0 0 0 0 8 - 5

14

B. Huang, H. Lin / Computers & Geosciences 28 (2002) 13–19

The resulting models can be represented by VRML and viewed interactively in most recent versions of Web Browsers. VirtualGIS is an add-on application of 3D visualization and analysis to ERDAS Inc.’s IMAGINE Essentials, and has similar functions to Pavan. In both packages, the generation of VRML models is not conducted on the Internet, and is loosely connected with the process of VRML model browsing. Similarly, Doyle et al. (1998) showed an example of the loose coupling of the ArcView GIS with VRML for constructing a virtual city environment. They indicated that this approach provides an option to building a virtual GIS (Batty et al., 1998) or a 3D GIS on the Internet. In category (b), Moore et al. (1999) illustrated how to interact with the VRML worlds via a 2D Java interface. This virtual interface allows a user to move between viewpoints, select a view required, and extract locational information from the model. The prototype VFCVRGIS (Raper et al., 1999) provides a link between a user-browsable virtual world and a map, and so the viewpoint/field of a view in the virtual world can be shown on the linked map. This prototype was developed by the MapObjects components and the Visual Basic language in conjunction with the Sense 8 VRML plugin. Another virtual interface provided by Brown (1999) employs both the Java external author interface (EAI) approach and script nodes to interact with VRML worlds such as draping an image layer over a terrain VRML model and querying a VRML world. The GeoVR toolkit presented in this paper is closely associated with category (a). Rather than 3D modeling of spatial objects in the natural world like buildings, the design of GeoVR, on top of an Internet GIS, is intended to explore an appropriate approach for interactively generating 3D VRML models from 2D GIS data, as well as providing a user-friendly interface for interacting with the GIS data on the Internet through a tight coupling of Internet GIS with VRML. This approach, in the form of Java/CGI, is neither a client-side nor a server-side application, but an integration of both, and thus enhances strengths of both methods. There has been an argument as to whether CGI is still suitable for the server-side Internet computation due to the emergence of Java servlets. However, since the CGI approach is basically simple and can satisfy our application purpose, it is still chosen as a typical example of the server-side applications. A similar situation occurs over whether VRML is suitable for deploying 3D content on the Web due to the growing interest in the Java 3D API. However, since VRML974 has been a standard for describing 3D scenes, and the Java 3D API [http://java.sun.com/products/java-media/ 3d] can in fact leverage its strengths [http://

4

[http://www.vrml.org/home.html].

www.vrml.org/consort/sun98.html], VRML is still considered as a preferable option in developing GeoVR. Since an early version of GeoVR (Huang and Lin, 1999) has been developed by using a CGI approach, this paper is centered upon the differences of the current version of GeoVR from its early version. The remainder of this paper is structured as follows: the next section introduces the hybrid approach of integrating Java and CGI after analyzing the pros and cons of both client-side and server-side methods. The following section then describes a prototype designed in terms of this hybrid approach. Corresponding examples are also demonstrated. Finally, some of the problems and future developments with the technology are discussed.

2. Java/CGI approach: a justification The recent rapid development of Internet technology has resulted in the migration of the conventional GIS functionality to the WWW. Correspondingly, several Internet GIS products have been brought to market such as Autodesk’s MapGuide, MapInfo Inc.’s MapX, Integraph’s GeoMedia Web Map and ESRI’s ArcView Internet Map Server (AVIMS) (ESRI., 1996, 1997a). Underlying these products, there are basically two approaches to deploying GIS or any other data-driven application on the Internet: server-side and client-side applications (Plewe, 1997; Gifford, 1999; Peng, 1999). 2.1. Server-side applications In a server-side application, a Web browser is used to generate requests, send them to the application server, and display the results. The application server processes the requests and delivers the result in a standard Web format (e.g., HTML) back to the client. In such an application, the client is usually an HTML page containing CGI forms connected with the application server, while all the software as well as the databases reside on the server that is administrated by the deploying organization. Having a large GIS database and functionality centralized on one or a few server machines significantly simplifies development, deployment and maintenance. Despite the simplicity and universality of CGI scripts, they suffer the drawback for GIS that they have a limited user interface and poor performance. In a GIS, there can be many applications in which users need to drag windows or select multiple features before an action takes place. It is difficult or impossible to do this with a standard Web interface like the CGI form. In addition, in a server-side application, some simple operations such as rooming or panning, turning a layer on or off, or taking any other action, the request must be

B. Huang, H. Lin / Computers & Geosciences 28 (2002) 13–19

sent to the server and returned. This results in many requests, which can cause poor performance.

2.2. Client-side applications Client-side applications run in the form of Java applets, plug-ins or ActiveX controls on the Web browser. To implement any of the previous solutions, software must be transferred to the client side. For example, plug-ins launch a special application module locally if a specific file type is contained in an HTML file when browsing the Web, transferring data-processing operations such as zooming and panning to the local client machine, and easing the workloads on the server side. As with plug-ins, the primary advantages of clientside application are the abilities to enhance the user interface and improve performance. Client-side solutions can be implemented with all the features and capabilities allowed by a modern graphical user interface (GUI). Window display changes or core GIS operations can be performed locally. The disadvantages associated with client-side solutions relate to distributing software

15

and data that is usually time consuming. Also, the processing of data on the client machine may not be as efficient as on a powerful server. Among the three forms of client-side applications, ActiveX controls can only be used by Microsoft’s Internet Explorer (IE), and thus is not advocated in a standard Internet application, where both Netscape Navigator and IE can be used for browsing the Web.

Fig. 2. Java-based client of GeoVR.

Fig. 1. Architecture of GeoVR.

16

B. Huang, H. Lin / Computers & Geosciences 28 (2002) 13–19

Plug-ins, despite their effectiveness, are non-standard and require the user to download and install separate software in advance, which can change according to the computing platform, also making a standard user interface difficult to implement. By contrast, it has been generally agreed that the use of the Java platform is now the most flexible and futuristic method since it can potentially achieve platform-independence and provide advanced programming functionality. To sum up, both the client-side and server-side solutions have pros and cons. A sensible strategy is, therefore, to combine both of them, typically in the form of Java and CGI approaches. Such an integrated manner can enhance the strengths of both solutions in the sense that it can provide a flexible and user-friendly interface, as well as make better use of the power of the server. This is also beneficial to the balancing of workloads on both sides. That is, the checking of parameter correctness and the basic map operations (e.g., zooming and panning) are performed on the client side, whereas complicated operations like 3D model generation and surface analysis are carried out on the server side. As a result, the integrated Java/CGI

approach is considered to be ideal for the development of the GeoVR toolkit. GeoVR is not coded from scratch, but is based upon an off-the-shelf Internet GIS, i.e., AVIMS, for the sake of ensuring longevity/stability of the software as well as avoiding reinventing functionality. At this stage, AVIMS is chosen as the most suitable one because it has the characteristics that favor of the Java/CGI approach: a Java-based client, MapCafe, providing basic GIS data display functions, extensibility on both the client and server sides, and seamless integration with ArcView 3D extension. ArcView 3D analyst (ESRI., 1997b) provides basic 3D visualization and analysis capabilities, which enhances the visualization functions of the ArcView GIS. Nevertheless, AVIMS along with MapCafe does not fully meet the requirements of a Java/ CGI approach as AVIMS is single-threaded and adopts a parallel mechanism in the sense that even basic operations such as zooming and panning need also to be executed on the server side. Fortunately, these problems can be partially tackled by extending both the client and server sides of AVIMS to achieve the desired functions. Such a method is also adopted in developing GeoVR.

Fig. 3. Interactive creation of VRML model of buildings on island.

B. Huang, H. Lin / Computers & Geosciences 28 (2002) 13–19

3. Architecture of GeoVR The client/server architecture of GeoVR is devised in the light of the Java/CGI approach (Fig. 1). It includes a Java-based client, a Web server and a visualization server. The Java-based client, essentially a Java applet, can communicate with not only the application server through the CGI program running on the Web server, but also GIS applications or other application programs on the client side. This indicates that the request from the client side can be responded from two sides rather than one side in the mere CGI approach. This is an important advantage of the Java/CGI approach over the conventional CGI approach. In this architecture, AVIMS provides a mechanism that can run application programs coded in the ArcView Macro Language, Avenue, through the CGI on the sever side in response to requests from the Java client.

4. Implementation of GeoVR The implementation of GeoVR serves to examine the feasibility and applicability of the Java/CGI

17

approach. It is carried out on both client and server sides. The client side of GeoVR is primarily a Java applet as shown in the central frame of the Webpage in Fig. 2. This Java applet displays a map with three layers (buildings, roads and contours) of an island, called Tsing Yi, in Hong Kong. The upper part of the applet is a group of buttons, which are used to pan, zoom, print, and identify spatial features on the map. Fig. 2 also displays in the right frame the attributes of a building that has been selected. Different from the interface of the MapCafe applet, a button with the ‘‘3D’’ text is added by using Java. This button is employed to create perspective views interactively of the selected 2D map layers, which are then transformed into VRML models, and displayed by the Cosmo Player VRML plug-in. For creating perspective views, a dialog in Fig. 2 appears to let users input their parameters, including the selected 2D theme, extruding height of spatial features, offset height, base height and others. The extruding height can be a constant or an expression. If an expression is needed, the ‘‘>’’ button in the right of the text field can be employed to assist in formulating the expression. Similarly, the items of offset

Fig. 4. Interactive creation of SPOT image overlaid on terrain surface.

18

B. Huang, H. Lin / Computers & Geosciences 28 (2002) 13–19

Fig. 5. Interactive creation of image of 3D scene.

height and base height can also be filled in this way. If the ‘‘Create 3D-VRML’’ button is selected, all the parameters are checked for correctness. For example, the sun azimuth must be within 0–3608. Note that this kind of work is performed on the client side by Java programs. Then, the parameters together with their values are encoded in a unique resources locator (URL) request. For example, in the case of Fig. 3, the URL request is thus: http://137.189.169.105/scripts/esrimap.dll?name= htmlmap&cmd=vrmlCreDisp&shpfile=Tybldg.shp &feaht=[stories]*4&offht=0&baseht=tytin &azimuth=45&altitude=60&zscefactor=1

the 3D scene is transformed into a VRML file (with .wrl extension). The nodes mainly used in this VRML file are IndexedFaceSet node and elevation grid; see Brown (1999) and Moore et al. (1999) for more details about these nodes. By using a Cosmo Player plug-in that has already been established on the Web browser, the VRML model can then be navigated and interacted. Fig. 4 shows the VRML model of a multi-spectral SPOT image in the TIFF format draped over the terrain surface of the Tsing Yi Island. If the ‘‘Create 3D-image’’ button is chosen, an image of the 3D model is created for a quick look of the 3D scene (Fig. 5).

5. Conclusions Since the variables such as ‘‘shpfile’’, ‘‘baseht’’ and ‘‘offht’’ are not defined in the ESRIMap web server extension of ArcView IMS, they are submitted by using the ‘‘POST’’ method. Through parsing by a ‘‘dispatch’’ script, the vrmlCreDisp command (script) is invoked. The vrmlCreDisp script written in Avenue first extracts the parameters for assigning base height, offset height, feature height, sun azimuth, altitude and vertical exaggeration factor from the URL request, then generates a 3D scene by using these parameters. Finally,

The conventional client-side and server-side methods have their drawbacks in developing a flexible and powerful Internet-based VR toolkit. An integrated approach, i.e., the Java/CGI approach, is, therefore, addressed to offer the best of two worlds. The development of GeoVR has demonstrated the advantages of such an approach over the conventional ones in providing both a flexible user interface and a powerful computation server. The Java-based client can also

B. Huang, H. Lin / Computers & Geosciences 28 (2002) 13–19

undertake some pre-processing tasks such as checking of parameter correctness, which eases the overload on the server side and reduces network traffic. The integrated approach also reserves more space for a toolkit to be extended on both the client and server sides. For example, using similar methods as presented in the development of GeoVR, more GIS functions such as network analysis, spatial analysis, image processing, and 3D geometric analysis functions can be added to AVIMS if necessary. This would construct a more powerful virtual GIS for collaborative geo-visualization. Although the GeoVR toolkit has provided basic functions for creating a virtual environment from existing GIS data, there are still some other functions that need to be implemented such as connecting VRML worlds with a spatial database and retrieving information of these worlds. Moreover, the use of Java servlets in place of CGI programs also needs to be explored.

Acknowledgements This project is supported by the Research Grants Council of HKSAR government under Grant No. CUHK 4334/98E, and by CUHK RAC under Grant No. 4720401. We would like to thank Mr. Eugene Tam for his help in preparing the data.

References Batty, M., Dodge, M., Doyle, S., Smith, A., 1998. Modelling virtual environments. In: Longley, P.A., Brooks, S.M., McDonnell, R., Macmillan, B. (Eds.), Geocomputation: A Primer. Wiley, Chichester, UK, pp. 139–161. Bishop, I.D., Gimblett, H.R., 2000. Management of recreational areas: geographic information systems, autonomous agents and virtual reality. Environment and Planning B: Planning and Design 27, 423–435. Brown, I.M., 1999. Developing a virtual reality user interface for geographic information retrieval on the Internet. Transactions in GIS 3 (3), 207–220. Counsell, J., 1999. 3D built form and landscape from 2D maps. Habitat 6, 41–43.

19

Doyle, S., Dodge, M., Smith, A., 1998. The potential of webbased mapping and virtual reality technologies for modelling urban environments. Computers, Environment and Urban Systems 22 (2), 137–155. Dykes, J., Moore, K., Wood, J., 1999. Virtual environments for student fieldwork using networked components. International Journal of Geographical Information Science 13 (4), 397–416. ESRI 1996. Avenue Customization and Application Development for ArcView. Environmental Systems Research Institute, Inc., Redlands, CA, USA, 260pp. ESRI 1997a. ArcView Internet Map Server. Environmental Systems Research Institute, Inc., Redlands, CA, USA, 60pp. ESRI 1997b. ArcView 3D Analyst. Environmental Systems Research Institute, Inc., Redlands, CA, USA, 118pp. Gahegan, M., 1998. Scatterplots and scenes: visualization techniques for exploratory spatial analysis. Computers, Environment and Urban Systems 21 (1), 43–56. Gifford, F., 1999. Internet GIS architectures}which side is right for you? GEOWorld 12 (5), 48–53. Huang, B., Lin, H., 1999. GeoVR: a web-based tool for virtual reality presentation from 2D GIS data. Computers & Geosciences 25 (10), 1167–1175. MacEachren, A.M., Edsall, R., Haug, D., Baxter, R., Otto, G., Masters, R., Fuhrmann, S., Qian, L., 1999. Virtual environments for geographic visualization: potential and challenges. In: Proceedings of the ACM Workshop on New Paradigms in Information Visualization and Manipulation, Kansas City, KS, November 6, 1999, pp. 35–40 Moore, K., Dykes, J., Wood, J., 1999. Using Java to interact with geo-referenced VRML within a virtual field course. Computers & Geosciences 25 (10), 1125–1136. Peng, Z.R., 1999. An assessment framework for the development of Internet GIS. Environment and Planning B: Planning and Design 26 (1), 117–132. Plewe, B., 1997. GIS-Online: Information Retrieval, Mapping, and the Internet. OnWord Press, Santa Fe, NM, USA, 311pp. Raper, J., McCarthy, T., Williams, N., 1999. Georeferenced four-dimensional virtual environments: principles and applications. Computers, Environment and Urban Systems 22 (6), 529–539. Unwin, D., 1997. The virtual field course. Second International Conference on GIS in Higher Education, Columbia, MD, USA, September 11–14, 4pp.