Mapping Spatial Data on the Web Using Free and Open-Source Tools : A Prototype Implementation

There is a growing need for web-based geographic information systems for easy and fast dissemination, sharing, displaying and processing of spatial information. The tremendous growth in the use of web and open-source geospatial resources has sparked development of web-based spatial applications to address multidisciplinary issues with spatial dimensions. This paper presents the integration of open-source geospatial tools and web technology to visualize and interact with spatial data using web browser. The goal of this paper is to implement a prototype system for web-based mapping by providing step-by-step instructions in order to encourage the eager developers and interested readers to publish their maps on the web with no prior technical experience in map servers. The implementation of mapping prototype shows the utilization of open-source geospatial tools which results in a rapid implementation with minimal or no software input cost.


Introduction
The geographic information systems (GIS) were initially adopted by users in the government sectors, but are now rapidly growing and have profound implications in a large number of application domains including planning [1], marketing [2], retail [3], transportation [4], traffic [5], tourism [6], natural resources [7], real estate [8], agriculture [9] and healthcare [10].These systems can be valuable planning tools to assist in the development and administration of scientific programs based on geographically identified needs [11].Linking location to information is a process that applies to many aspects of business such as choosing a site, targeting a market, planning a distribution network or delivery route, drawing up sales territory and allocating resources [12].The companies, communities and individuals are realizing that they must have geographical information to understand their world.
The tremendous growth in popularity of the internet and the growing public interests in accessing online geo-spatial information have given a move to develop web mapping applications.The web is playing a huge role in spatial application development mainly because of advantages such as platform independency, reduction in distribution costs and maintenance problems, ease of use and widespread access.The most important power of web-based spatial application is the capability to publish and share geo-spatial information on the web which jointly allows information to be exchanged in a rapid and efficient manner thereby helping individuals make important decision quicker.The geo-spatial information not only includes maps or locations of landmarks, but multiple attribute data, socioeconomic data, aerial photographs, satellite images, etc., which may have static or dynamic characteristics [13].
This paper is aimed to provide a method for building a new web-based spatial visualization prototype by using a combination of open-source geospatial packages and Microsoft .NET platform.The following sections specifically document the development and implementation of a prototype system by adopting web-based client-server computing technology.

Open-Source Geospatial Tools
The commercial software are predominantly "closed source" which means the code cannot be accessed or modified and they may, in some cases, come at a relatively high price with ongoing licensing fees to maintain their use.These systems are thus often priced out of the reach of the resource-constrained areas, particularly within developing countries, which lead them into seeking open-source alternatives [14].The wide spread free of cost availability, freedom to read, redistribution and modification facilities have made the open-source packages as feature rich alternatives to proprietary software packages [15].These packages can help the implementation of mapping and spatial analysis tools in a large number of private and public firms, especially in those small organizations that cannot afford proprietary software's cost, complexity, training cost and special requirements.The market of open-source geospatial packages is growing [16] and the quality of these packages is improving with the strong and free collaboration between a large numbers of developers from all around the world.
The open-source project offerings cover the spectrum of tools that interact with geospatial data.The interaction occurs on several fronts: creating, converting, manipulating, analysing or visualizing the geospatial data.These are the common categories of tools or the functional components of open-source geospatial tools.Figure 1 represents the organization of these tools around the geospatial data and some of the well-known geospatial tools are listed in Table 1.2).

.NET Framework
The .NET Framework is a technology that supports building and running the next generation of web services and applications.It is a managed execution environment that provides a variety of services (memory management, common type system, language interoperability, version compatibility) to its running applications.Its main components include [19]: the common language runtime (CLR), which is the managed execution environment that handles memory allocation, error trapping, and interacting with the operating-system services; the .NET Framework Class Library, which is an extensive collection of programming components and application program interfaces (APIs) for all major areas of application development; ASP.NET, a server side web technology which supports creation of dynamic web applications, websites and web services.
The advantages offered by the .NET Framework include shorter development cycles (code reuse, support for multiple programming languages), easier deployment, fewer data type related bugs due to integral type safety, reduced memory leaks, and, in general more scalable, reliable applications.

Visual Studio .NET
The Microsoft Visual Studio .NET is an integrated development environment (IDE) to develop console and graphical user interface applications along with web applications, web services, websites and windows forms.It supports different programming languages (C#, C++, Visual Basic, J#, etc.) by means of language services, which allow the code editor and debugger to support nearly any programming language, provided a languagespecific service exist.3 shows the starting screen of Visual Web Developer 2008 Express.The idea of Express edition is to provide streamlined, easy-to-use and easy-to-learn IDEs for users other than professional software developers.It allows web development with ASP.NET using drag-and-drop user interface designer, enhanced code editor, support for other web technologies (e.g., CSS, JavaScript, XML) and integrated design time validation.

Preparation of Geospatial Data
The city of Taj, Agra in India is selected as a pilot area to create the prototype spatial mapping system.The geographic location of the scope lies within 27.11˚ latitude north and 78.20˚ longitude east and is covered in 1:50,000 scaled sheets 54E/16-54I/4 of Survey of India.
The data that is stored in spatial information system can be thought of as a digital representation of real world objects.These objects can be abstracted into either discrete objects such as houses or continuous fields such as elevation and are stored as vector or raster data structures respectively.The raster model is a representation of the world as a surface that is divided into a regular grid of cells.The vector model represents space as a series of discrete entity-defined point, line or polygon units which are geographically referenced.The vector data models are more compact and predominant across the diverse range of spatial information systems [6,7,20,21] and therefore we have focused on vector model for mapping the geographic data in web-based environment.
The geographic objects together with their attribute data constitute spatial data (known locations on the earth with statistical and non-location data associated with spatial entity).The collection of spatial data under vector model is organized in a thematic approach that categorizes data in layers.Usually, each data layer represents only one type of spatial entities, i.e., point, line or polygon.
There are many sources for obtaining spatial data including hard copy maps; aerial photographs; remotelysensed imagery and existing digital data files.For the scope of this prototype application, a geo-referenced color raster map is obtained in digital format from the Survey of India (government organization).This raster map is processed using Quantum GIS (an open-source desktop mapping engine) to create separate vector layers for different geometry types.Table 2 lists some of the common layers created by extracting geo-objects from the raster map and are used in the prototype application.These layers are saved in ESRI's (Environmental Research System Institute, Redlands, California) shapefile format.

System Components 1) Database
The analysis on spatial data can be performed well if the data of geographic objects is stored in relational database.For this reason, all the layers (shapefiles) of the study area are converted to their corresponding tables in a PostgreSQL database.PostgreSQL is one of the most popular object-relational database management system (ORDBMS) on the open-source platform.It is not easy to store the spatial data in a standard RDBMS, thus spatial extensions have been developed and standardized by the OGC (Open Geo Consortium).
PostGIS is an open-source and OGC compliant spatial database extender for PostgreSQL [22].It adds spatial function and specialty geometry data types to the database.It is an excellent way to bring tabular and spatial data together into a common management environment.The conversion of shapefiles to PostgreSQL database tables is achieved using the shp2pgsql utility included as part of the PostGIS extension.This utility takes a shapefile and outputs a series of SQL statements to create a table in PostgreSQL database.The resulting table contains all the attributes of the shapefile including the  coordinates that define each feature.This process was repeated for each of the vector layers created for the scope of prototype.Figure 4 shows the flow diagram of necessary steps to create the spatial database.Table 3 represents the open-source geospatial tools used to implement web-based mapping application.
2) Mapping Server Internet map server applications easily make spatial data accessible through a web browser interface to end users.The map servers usually serve spatial data based on three OGC standards: WMS (Web Mapping Service) for the display of maps as image; WFS (Web Feature Service) for vector data; and WCS (Web Coverage Service) for raster data.The two best-known open-source map servers are Minnesota MapServer and GeoServer.Both of these are viable alternatives to proprietary map servers.
We have used MapServer for development of current prototype, because it has an excellent performance of functionality and speed on processing large volume dataset.It is considered as the world's leading open-source web mapping tool and complies with WMS, WFS and WCS web specifications of OGC [23].It is a server-side piece of software which renders spatial data source into cartographic map products on-the-fly [24].The main components of the MapServer are mapfile and CGI program.
A mapfile defines how data is used and sets the display and query parameters for the map.It needs to set cartographic parameters, cartographic objects, data load- 3

) Development Environment and User Interface
The user interface design makes the user's interaction simple and efficient in terms of accomplishing user goals.It allows the users to select and input the query criteria in order to view the required data.In the present prototype application, the user interface is made up of ".aspx" files which are populated with the appropriate controls using Visual Web Developer 2008 Express as the .NET development environment.view of user interface implemented with ASP.NET by which user interact with the navigation tools such as zoom in, zoom out, zoom to full extent to view the map at different scales and identification of different map features.The prototype system adopts client-server architecture where most of the processing takes place on the server side while the client is used for gathering input from the user and displaying map and other associated data based on query parameters.The server-side approach only requires a browser as the spatial mapping and processing; modelling, database and other components will be located on the server.The architecture of the prototype application is shown in the Figure 6, in which the users using any of the popular internet browsers requests geospatial information from the web server.
The web server forwards the request to the ASP.NET application server in which C# Mapscript is called for geospatial data.C# Mapscript forwards the map request to MapServer and the MapServer using the mapfile generates a map based on the geospatial data supplied by the PostGIS.The generated map is sent back to the web server, which forwards it to the web client.

Explanation and Code
The prototype application contains two web forms named Default.aspxand MapStreaming.aspxby following the flow of [25].The Default.aspx form contains all the controls required to perform various operations on the map and geospatial data.This form is populated with following controls:  cblLayers (CheckBoxList) for selection of layers to be displayed  ddlLayers (DropDownList) for selection of layer to be identified  litIdentifyResult (Literal) for display the result of identified map features  ibtnMap (ImageButton) for display the map  ibtnZoomIn (ImageButton) to perform zoom in  ibtnZoomOut (ImageButton) to perform zoom out  ibtnPan (ImageButton) to perform panning  ibtnIdentify (ImageButton) to identify the features of selected layer  ibtnFullExtent (ImageButton) to display the full extent map  ibtnRefresh (ImageButton) to refresh the map  rblAction (RadioButtonList) to set the map action with item values Zoom In, Zoom Out, Pan and Identify The MapStreaming.aspxform does not contain any control and is used to send the image stream to the ibtnMap control.The following Figure 7 represents the flow of code among the components of prototype application.
The next section describes the code to implement the essential functions of mapping (detailed code is available on request from authors).

Figure 3 .
Figure 3. Microsoft Visual Web Developer 2008 Express Edition-start page.

Figure 4 .
Figure 4. Flow diagram of spatial database development.Table 3. List of open-source geospatial tools used in study.Category Open-Source Geospatial Tool Data Creation Quantum GIS Data Conversion shp2pgsql (PostGIS) Data Manipulation PostGIS Data Analysis PostGIS Data Visualization (Internet Mapping) UMN MapServer

2. 3 . 3 .
System Configuration and Architecture 1) Hardware Platform Configuration The server machine used for prototype application development has the following specifications: CPU: Pentium Dual 3.00 GHz with 2 MB Cache Main Memory: 2048 MB (1024 × 2) HDD: 80 GB Operating System: Windows XP (SP3) Web Server: Internet Information Server (IIS) 6.0 DBMS: PostgreSQL with PostGIS 2) System Architecture

Figure 6 .
Figure 6.Architecture of prototype mapping application.

2.2. Microsoft .NET Platform
The built-in languages include Visual C++, Visual Basic, Visual C# and Visual J#.It also supports XML/XSTL, HTML/XHTML, JavaScript and CSS.It has comprehensive tools (drag-and-drop form designer, IntelliSense, dynamic help) for rapidly building and integrating applications which increases developer's productivity.The Microsoft Express set of free software applications offer a way around budget limits, as all of the software are free, albeit somewhat restricted.Visual Web Developer 2008 Express is a .NET developer's integrated development environment (IDE) provided for free by Microsoft.It is a lightweight version of Microsoft Visual Studio product line.Figure