MapServer Performance Tips

Hal Mueller hal at MOBILEGEOGRAPHICS.COM
Tue Aug 7 14:45:44 EDT 2007


Try the idiom below for the class breakouts.  This will give you one 
layer, with multiple classes, instead of 5 layers from the same data. 
Order the CLASS definitions so that the most common class is listed 
first.  I believe (but don't know for sure) that your present 
definition causes all of the geometry to be read 5 times (once for 
each layer).

I think you can pull the CLASS MINSCALE/MAXSCALE up to the LAYER 
level.  Not sure what improvement that would have though.

One other thing I would suggest is preprocessing your EXPRESSION 
line.  Instead of computing it on the fly based on LOWER and UPPER, 
compute a new column when the DBF is generated, which is 1 for -98 to 
-104, 2 for -94 to -98, etc.

If this is not enough, consider creating two different levels of 
polygon data, one coarse (for small scales) and one fine (for large 
scales).  This step made a big difference for me.

Hal

   # ==============================================
   # Layer: Propagations
   # ==============================================
   LAYER
     GROUP "Propagations"
     NAME "all propagations"
     STATUS DEFAULT
     TILEINDEX "propagations/tileindex"
     TILEITEM "location"
     TYPE POLYGON
     # --------------------------------------------------
     # Class: -98db to -104db
     # --------------------------------------------------
     CLASS
       NAME "-98db to -104db"
       EXPRESSION ([LOWER] >= -104 AND [UPPER] <= -98)
       MINSCALE 0
       MAXSCALE 1200000
       STYLE
         COLOR 255 128 0
         OUTLINECOLOR 255 128 0
       END
     END

     # --------------------------------------------------
     # Class: -94db to -98db
     # --------------------------------------------------
     CLASS
       NAME "-94db to -98db"
       EXPRESSION ([LOWER] >= -98 AND [UPPER] <= -94)
       MINSCALE 0
       MAXSCALE 1200000
       STYLE
         COLOR 0 0 255
         OUTLINECOLOR 0 0 255
       END
     END

[continue the class definitions...]

   END

-- 
Hal Mueller                hal at mobilegeographics.com
Mobile Geographics LLC     http://www.mobilegeographics.com/



More information about the mapserver-users mailing list