Using data compression to improve the transmission and rendering performance of SVG maps over the Internet


Table of Contents

1. Introduction
2. Viewing transformation principle
2.1 Viewing transformation principle (window-to-viewport transformation)
2.2 Do we need so much detail?
3. A visual lossless data compression method for SVG map
3.1 Calcluate SVG Map's new viewBox
3.2 Use relative coordinates in a "path"
3.3 Filter out unnecessary coordinates in a "path"
4. Some preliminary tests
5. Conclusion and Future work
Acknowledgements
Bibliography

With the rapid development of the Internet, web-based spatial information system is an inevitable trend. W3C's SVG[1] is a promising standard for publishing geospatial data over the Internet. Many scientists or engineers have tried to use SVG to create a web spatial information system or to publish the maps on internet. They used the shape elements and graphic style of SVG for map display and developed some prototype systems.

But when using SVG to publish (represent) very large geospatial dataset, we always have to wait a long time for the SVG map to load. The delay of loading SVG maps over Internet includes two parts: the network transmission delay and the rendering delay in client side. The latter mainly relates to the performance of SVG Viewers (such as Adobe SVG Viewer), and the complexity (such as xlink, filling, animation, filter effects, gradients, patterns, clipping, masking and compositing) and the data amount of SVG documents (maps). The network transmission delay is mainly caused by the data amount of SVG maps and the network transmission speed. In general, the former is far longer than the latter. Thus, reducing the data amount of SVG maps will shorten the network transmission time, and then improve the network transmission and rendering performance.

Data reduction is to filter out some less-important information and then reduce the data amount. If the data after reduction is acceptable (for example, visually acceptable), the data reduction method is feasible. There are two kinds of data reduction: lossless data reduction, and lossy data reduction. Both of them can be used in reducing the data amount of SVG maps.

Lossless compression (reduction) algorithms usually exploit statistical redundancy in such a way as to represent the sender's data more concisely without error [2]. Lossless compression schemes are reversible so that the original data can be reconstructed. There are a lot of lossless compression algorithms available, such as Lempel-Ziv[3], DEFLATE (Gzip)[4] , LZR. Some HTTP Servers also provide compression module, such as Apache web server's mod_deflate module [5], to allow data to be compressed before being sent to the client over the network, and then be auto-decompressed by web browsers such as Internet Explorer (IE), Firefox, Opera, Safari. We can use these algorithms (HTTP Servers) to reduce the data amount of SVG map before sending the SVG map to the client, and then decompress (reconstruct) the data to the original SVG map.

Lossy data compression (reduction) is possible if some loss of fidelity is acceptable. Generally, a lossy data compression will be guided by research on how people perceive the data in question [2]. Lossy compressions will lose some data and is unreversible. There are some lossy data compression algorithms which is special for GIS data (geometric data) which can be used prior to sending the data, such as line simplification (Douglas-Peucker algorithm [6]), map generalization. But these algorithms are too complicated (such as high time and space complexity), and still under developing. Based on computer graphics' viewing transformation principle (the mapping of a part of a world-coordinate scene to device coordinates), this paper proposes a visual lossless data reduction method to reduce the data amount of SVG maps while preserving the visual effects (visual anti-distortion). The SVG maps created by this method can adjust their data amount dynamically to the size of the output screen and the maximum visible scale of the dataset.

The paper is arranged as follows. In section 2, we introduce the viewing transformation principle, and discuss why we can reduce the data amount. Section 3 proposes a visual lossless data compression method for SVG map based on viewing transformation principle. In section 4, we carry out some tests to evaluate the suggested method. Finally, the conclusions and future work are presented in section 5.

In this section, we will introduce computer graphics' viewing transformation principle, and then explain why we can reduce the data amount of SVG map.

Geospatial datasets are always stored/ represented in database (such as SQL Server 2000, Oracle) or some initial dataset (such as Shape, E00, or GML file). When using SVG to publish geospatial dataset (a real world area selected for display), people always "move" the geographic (world) coordinate pairs directly from initial dataset to SVG document. The value of attribute "viewBox" in root svg element is always set as the bounding of the geospatial dataset (the real world area). The bounding is always represented as a list of four world-coordinate numbers min-x, min-y, width and height, separated by whitespace, which specify a world-coordinate area (rectangle) selected for display. For example, when we try to use SVG to publish the administerial district map of Guangdong Province (China), the value of "viewBox" always set as "94928 2172873 790615 595213" which is the bounding of Guangdong Province.

In order to visualize the SVG map, a display area on the monitor should be selected to put the SVG map. As pixel is the smallest unit that can be displayed on a screen, according to the viewing transformation principle, suppose that the display area of client side's screen (monitor) to render the above SVG-based administerial district map is 1280*964 pixels, all the points in area of (790615/1280)*(595213/964) =617*617 in Guangdong district map will be mapped to one pixel (Figure 2). Thus, when using SVG to visualize geospatial dataset, it is unnecessary to use world coordinates in SVG map.


In the following, we will introduce a visual lossless data compression method for SVG map based on viewing transformation principle.

The basic concept of the suggested method is: based on window-to-viewport transformation, resize SVG Map's viewBox to fit the viewport while preserving the visual effect. It includes three steps: 1)Calcluate SVG Map's new viewBox, and transform spatial object's coordinate pairs correspondingly. 2) Use relative coordinates in a "path". 3) Filter out unnecessary coordinates in a "path".