SVG Explorer of GML Data

Keywords: GML, Web GIS, SVG

Luca Piazza Bonati
Junior Researcher
Via G. Moruzzi 1, 56124 Pisa


Luca Piazza Bonati is a computer engineer and he works as Junior Researcher at the ISTI-CNR, an institute of the Italian National Research Council. His research activitiy is focused on the study of the OpenGIS and XML technologies (in particular GML and SVG) referred to the interoperability problem and to the definition of Spatial Data Infrastructures. Other research topics are the LBS and the development of GIS applications for wireless devices, based on open standards.

Luciano Fortunati
Via G. Moruzzi 1, 56124 Pisa


Luciano Fortunati has been involved for a long time with Geographical Information Systems. He started initially (80's) with Remote Sensing and Image Processing applications and moving next (90's) to GIS. He faced aspects linked to specific software developments and to applications in project participation. At present he is interested to the integration of technologies, as wireless, PDA, Internet, GPS, applied to the implementation of Location Based Services and, more general, to the growth of the GIS applications world.

Giuseppe Fresta
Via G. Moruzzi 1, 56124 Pisa


Giuseppe Fresta has been associated with the Italian CNR since 1973, when he was concerned with methods and systems for the elaborations of graphic data, and information systems to manage environmental data. He is now engaged in the design and development of user interfaces, hypertext/hypermedia, and Web publishing; in particular he is interested in the evolutions of the XML standard with its associated technologies (DOM, XSLT, SVG).


The OpenGIS Consortium has been developing, through time, the GML (Geography Markup Language) , a non-proprietary language (public domain) specifically defined to codify, archive and transfer (via Internet too) spatial data. Based on the XML standard, the GML handles both the geometry and the properties of the geographical elements; this allows the various data providers to share heterogeneous data sets and the users to access the data in a completely transparent way. From the application point of view, it simplifies and standardizes the operations in many sectors, from map building to data format transformation, from spatial query to geographical analysis, including the emerging applications in mobile systems. Since the GML data structure is XML-compliant, it can be transformed in a SVG (Scalable Vector Graphics) document format and then easily displayed on a standard web browser.

Because this technology is continuously evolving, this work presents an overview on some aspects of the state-of- the-art, an evaluation of the advantages and disadvantages, and a demo application of the use of this technology in the field of building and querying thematic maps.

The SVG Explorer application is running on a web browser (Microsoft Explorer) and all the functionalities are working at the client side on local and/or remote (WWW Internet) data. The application's main goal is the processing of GML documents and their visualization in a graphical way, with the interaction of the user. A set of basic functionalities handling both the graphical (zoom, pan, symbols, styles, ...), the geographical and the thematic aspects (multilayer organization, elements classification and aggregation by attributes, ...) have been developed. SVG is mainly oriented to vector data but can define also raster data as JPEG, PNG files containing georeferenced images; with this approach the overlay of vector data on a raster data background is allowed. All the functionalities are operating in an ECMA Script environment, making use of libraries implementing base primitives working on GML and SVG data structures (as recommended by W3C).

The aim of this work is not only building a specific application, but is for three-fold:

The SVG Explorer can also be seen as an evolved application using the Web Feature Service (defined by the OpenGIS project) for the features (GML coded) presentation and manipulation at client side.

Table of Contents

1. The GML and the XML standard
     1.1 The geographical entities in the GML
     1.2 The graphical representation tool
2. The SVG Explorer application
     2.1 Application architecture
     2.2 Graphic User Interface
     2.3 Application features
3. Conclusions

1. The GML and the XML standard

A lot of problems linked to data interoperability (data formats, spatial models, GIS software, GIS applications, ...) in a distributed environment have long been the layout of discussions in the information system world.

A contribution to their solution comes from the eXtensible Mark-up Language (XML) [2] , to save and represent data in an extensible and flexible way, following an appropriate paradigm, independent of the data producer. Infact XML represents a tool to code data in a textual way and can combine together a large variety of data types, including text, graphics, audio, etc., and the spatial information too, amplifying its value and usability. Since the XML separates the presentation from the content, different XML transformation technologies have been developed for a variety of devices, from the desktop to the palm computer, to the wireless devices.

The OpenGIS Consortium operates in order to define a neutral data format (not linked to the GIS software producers, even if they are the main actors), and one of the most recent development has been the definition of the Geography Mark-up Language (GML) specifications [1] .

The GML is an XML based language to represent geographical data and their meaning. The geographical data refer to a spatial representation of the world, independent of any specific visualization of the data. The GML has its own structure to code spatial data and their associations: this structure can be extended also to modeling a specific application context. In general, the GML has the capacity to combine and to associate spatial data with other types of data (XML or GML expressed), leading to a solution the problem connected to the integration with heterogeneous data.

At lower level, the GML provides a method to represent the spatial elements (features) as text within an XML document. Such documents are easy to be decoded and can be extended to represent the relationships not only with other elements, but also with no-spatial attributes and complex entities (making use of the linking ability of the XML). The GML must be "styled" in order to be "presented", generally as map or image, but also as text or even voice.

1.1 The geographical entities in the GML

It has been defined a GML Application Schema for the GML data handled by the GIS Explorer, according to the definition of the GML Schema, presented in the GML speciifcation (version 3.0). A GML application schema is an XML Schema [4] written according to the GML rules for application schemas and which defines a vocabulary of geographic objects for a particular domain of discourse.

The GML application schema extends the base GML schema and defines a new type for handling the geographical features. This type, called gmlde_ns:featureType, is an extension of the standard gml:AbstractFeatureType and it has been created to manage the alphanumerical properties of the geographical data together with the geometry properties. The Application Schema is described in Figure 1 .

<?xml version="1.0" encoding="iso-8859-1"?>
    <documentation xml:lang="en">
      GML Schema for GMLDE Data
  <import namespace="" schemaLocation="feature.xsd"/>
  <!-- Element Declaration-->
  <element name="gmlde_ns:feature" type="gmlde_ns:featureType" substitutionGroup="gml:_Feature"/>
  <element name="gmlde_ns:Property" type="gmlde_ns:PropertyType"/>
  <!-- Type Declaration-->
  <complexType name="featureType">
      <extension base="gml:AbstractFeatureType">
          <element ref="gmlde_ns:Property"/>
  <complexType name="PropertyType">
      <extension base="string">
        <attribute name="gmlde_ns:name" type="string"/>
    	<attribute name="gmlde_ns:type" type="string"/>

Figure 1: Application Schema

The GML 3.0 represents the geographical information in a vector format way. A map, considered as a set of layers of vector data, is represented by GML with the gml:featureCollection element, containing information about all the layers. Inside it is present the gml:name element, indicating the file name, the gml:description element, used to write a description of the data contained in the GML file and the gml:boundedBy element, describing the containing box (in terms of geographic coordinates) of all the geographical entities of all layers. Beside, one or more gml: featureMember elements can be present, each one representing one layer and defining its geometric and alphanumeric properties. Each geographical entity contained in a layer is represented by the gmlde_ns:feature element. Two parts compose this element: one for the geometrical property (gml:geometryProperty) and the other for the attributes (gmlde_ns:Property) of the entity. The gml:geometryProperty element contains the coordinate Reference System name (srsName) and all the geographic coordinates of the entity, for the features gml:Point, gml:LinearRing and gml: Polygon. The srsName can be defined for each single GML element containing inside the coordinates: this permits to have geographic entities described in various coordinate systems inside one GML document or even one layer.

About the attributes of the geographic entities, the GML 3.0 specifications do not specify a single way for their representation; they can be included within a document in any XML format. In the adopted approach, the attributes are included within the gmlde_ns:Property element, specifying the name, the type and the value. An example of this structure is shown in Figure 2 .

<?xml version="1.0" encoding="iso-8859-1"?>
  <gml:name>File Name</gml:name> 
  <gml:description>File Description</gml:description>
      <gml:Box srsName="EPSG:XXXX">
        <gml:coordinates>x1,y1 x2,y2</gml:coordinates>
	<gml:featureMember gml:fid="PolygonLayer">
	  <gmlde_ns:feature gml:fid=" PolyFeature1">
	    <gmlde_ns:Property gmlde_ns:name="AttrName" gmlde_ns:type="AttrType">
	    <gml:geometryProperty gml:gid="PolyGeometryId">
		  <gml:Polygon srsName="EPSG:XXXX">
			    <gml:coordinates>x1,y1 .. xn,yn .. x1,y1</gml:coordinates>
	<gml:featureMember gml:fid="LineLayer">
	  <gmlde_ns:feature gml:fid=" LineFeature1">
	    <gmlde_ns:Property gmlde_ns:name="AttrName" gmlde_ns:type="AttrType">
		<gml:geometryProperty gml:gid="LineGeometryId">
		  <gml:LineString srsName="EPSG:XXXX">
		    <gml:coordinates>x1,y1 .. xn,yn</gml:coordinates>
	<gml:featureMember gml:fid="PointLayer">
	  <gmlde_ns:feature gml:fid=" PointFeature1">
	    <gmlde_ns:Property gmlde_ns:name="AttrName" gmlde_ns.type="AttrType">
		<gml:geometryProperty gml:gid="PointGeometryId">
		  <gml:Point srsName="EPSG:XXXX">

Figure 2: Example of GML Document

1.2 The graphical representation tool

A main goal of GML is to represent the content of geographical data. This language can be used also to represent these data as maps, by using a rendering tool to interpret the GML data. In other words, it is necessary to "re- code" the GML elements in a suitable way so that they can be represented, for example, by the graphical display of a web browser (map styling). This operation interprets the GML contents by means graphical symbols, line styles, areas filling, sometime also the transformation of the data geometry according to the representation requested

Generally this process (graphical rendering) transforms the GML data in a XML graphical format. Some major vector graphical formats for viewing is:

Today a variety of graphical render programs are available for the various XML graphical formats, both as native in the web browser, as plug-in for the browser, as stand-alone viewer, or as library of functions. The map styling operation can be executed either on the server or on the client side, by means Map Style Sheets completely portable from server to client and from client to client.

In the map styling process, the SVG Explorer application transform the GML elements in SVG elements in order to represent them in a graphical way [5] . This operation assigns to each GML tag, refered to the geometrical property of a geographical element, a SVG tag and establishes a sort of correspondence between these tags. This correspondence is not always unique but in some cases there are more than one SVG tag that can represent a GML geometrical property tag. Table 1 describes the SVG elements used by SVG Explorer in the map styling operation to produce the map.

Correspondence between GML and SVG elements
GML geometry element SVG element
Box rect
Point rect, circle or path
LineString polyline, path
Polygon path

Table 1

The GML Box element is represented by the rect SVG element, while the Point element can be represent by different shapes, depending on the user preferences. The default transformation use the rect element but the user can visualize a point also as a circle or using the path element in order to draw particular symbols (such as triangle, stars, etc.). The other two GML elements, the LineString and the Polygon, are respective trasformed into a polyline and into a path element.

Sometimes it can be useful to visualize on the map non-geometrical GML property such as labels or annotations; in this case, they are represented by the SVG text element.

2. The SVG Explorer application

The SVG Explorer application allows the visualization and the analysis of spatial data, codified by means the GML. The respective program is carried out in ECMAScript language [6] and uses the SVG plugin by Adobe for the visualisation. As the most part of the functionalities are oriented mainly to visualization of geographical data on attribute basis, this approach permits to perform the respective operations at client side only, when downloaded the required GML data.

Here is a list of major functionalities:

2.1 Application architecture

The SVG Explorer application has been developed using a modular architecture, composed by a set of functional blocks ( Figure 3 ). Each block contains the ECMAScript functions carrying out specific application functionalities. All the functions are implemented at client side; they integrate various components and are activated by the interaction on the user interface loaded at the application start-up.


Figure 3: Architecture

The main blocks of the application are:

All the modifications due to a change of the map style or to the result of a classification operation, are performed using the DOM interface of the ECMAScript language. All the main functionalities of the application are carried out at the client side, using the power of the ECMAScript interpreter of the Adobe SVG plugin. The modular architecture of the SVG Explorer foresees the growth of the number of the functional blocks, allowing the application customization depending on the user needs.

2.2 Graphic User Interface


Figure 4: User Interface of the SVG Explorer of GML Data

All the functionalities of SVG Explorer are activated by means buttons of the user interface ( Figure 4 ); this is composed by five parts:

  1. the toolbar: in this area are located the buttons to control some aspects of the map visualization (pan, zoom, etc.) and to activate the main functions of the application such as the visualization of the attribute table and the classification operation;
  2. the layer panel: this panel controls the hierarchical view of the layers. The user can act some operations on the active layer such as change its position on the stack, duplicate it, delete it and show its related information;
  3. the layer property panel: this is the part where the user can set the visualization style of the active layer. It is possible to make a layer active or inactive; to change the fill color, the color and the dimension of the stroke line; to show labels on the map and to change the symbols type presented on the map;
  4. the statusbar: this part is used to show messages to the user, such as button tooltips, help messages and the cursor coordinates;
  5. the map panel: in this area the graphical representation of the GML data is visualized.

2.3 Application features

The SVG Explorer of GML Data is a demo application developed in order to test the XML technologies and to create basic environment on which develop customized GIS application. Some features have been already implemented and, due to the positive results given by this prototype, other ones have been planned in order to make the SVG Explorer a more complete application. Figure 3 summarize the SVG Explore status in terms of implemented, on working and planned features. These are "common" features because they can be requested in all the basic GIS operations. There are also "specific" features (not listed on the Figure 3 ) implementing specific GIS operations (this is the core of Web GIS) that we plan to define and implement according to the projects we are involved.

Implemented, on working and planned features
Features Implemented On working Planned
Pan and Zoom X - -
Show coordinates on mouse-move X - -
Change symbolization/colors X - -
Load multiple GML files X - -
Save GML and SVG file - - X
Hierarchical layers organization and handling X - -
Show element attribute on mouse click X - -
Elements selection by attribute X - -
Element classification by attribute X - -
Show attribute table X - -
Get curson position in terms of real coordinates X - -
Load georeferenced raster image - X -
Scale settings X - -
Coordinate reference system transformation - - X
Map composition and printing tools - - X
OpenGIS WFS compliant - - X
OpenGIS WMS compliant - X -

Table 2

3. Conclusions

In the following items are reported some notes about some aspects characterizing the experience on the use of the XML technology applied to GIS environment:


OpenGIS Geography Markup Language (GML) Implementation Specification, Open GIS Consortium, January 2003.
Extensible Markup Language 1.0 (second edition), World Wide Web Consortium, W3C Recommendation, October 2000.
Scalable Vector Graphics 1.1 Specification, World Wide Web Consortium, W3C Recommendation, January 2003.
XML Schema Part 0: Primer, World Wide Web Consortium, W3C Recommendation, May 2001.
Making maps with Geography Markup Language (GML), Lake R., Galdos Systems inc, October 2000.
ECMAScript Language Specification, ECMA International, Standard ECMA-262, December 1999.

XHTML rendition created by gcapaper Web Publisher v2.0, © 2001-3 Schema Software Inc.