cybersoft_map_agg.png

Summary
One of the upcoming power features of Mapserver 5.0 is its AGG Rendering engine. Above is an example image of the AGG rendering capabilities of Mapserver. Below is a list of my experiences with Mapserer 5.0 AGG

  • Slower than GD ofcourse, but cartographic quality is really impressive…
  • You need to have SUPPORT=AGG to be able to use AGG. So far, I was not able to compile mapserver source with AGG, however using mapserver-beta-3 for linux and ms4w betas worked fine.
  • Layer Transparency. I was not able to get transparency for my roads overlaying on top of my basemap. Tbonfort from IRC suggested I use RGBA for the outputformat, but it still breaks. Hope Im not missing anything important here…

The Mapfile
Currently, the mapfile ( map_all_agg.map ) contains 2,587 lines! The lengthy mapfile consists of the ff: districts or political boundaries, water bodies, greens or open spaces, roads, subway lines, subway stops. The roads is classified into 12 categories ( Expressway, Class-1, Class-2, Class-3, Class-4, Major Road, Main, Secondary, Minor, CommunityRoad(w/name), CommunityRoad, ParkRoads). Class1-4 is a classification for Roads outside the 5th Ring Road of Beijing. While Major Roads – Minor Roads is a classification inside the 5th Ring. The roads were drawn as a line layer and not as a polygon.

How to achieve the overlapping of road intersections?
The technique is to seperate the road boundary layer from the actual road line. A mixture of widths and color management was employed to achieve the effect. Essentially, we started with the ff:

1. road boundary layer
2. road layer

Further , trial and error resulted in refining the road boundary layer with different minscales and maxscales. The same was adapted with the road layer. Download map_all_agg.txt. My next iteration, would be to refactor some of the road layers if possible.

A couple of notes to myself, we could speed things up by trying out the ff:

  • Using SHPTREE
  • Simplifying the geometry as you change scales

Testing Methodology
1. Use Firefox and install firebug.
2. Download YSlow from Yahoo.
3. View load times using “net” tab
firebug-1.png

Using SHPTREE
1. The utility specifies indexes as it slices the shapefile into quadrants as specified from its definition. To run shptree, do the ff:

$ shptree roads.shp
creating index of new LSB format

2. It would generate a roads.qix. No changes need to be made with the mapfile. Mapserver loads the shapefile without the extension.

3. Testing… Significant speed improvements were made as shown below:

  • Before: 29.44 secs
  • After: 5.91 secs