How to avoide HUGE .map files

Ed McNierney ed at TOPOZONE.COM
Thu Mar 9 13:36:41 EST 2006


Ed -

I have spent some time looking at performance-tuning MapServer
configurations.  After a while I finally realize that my "kitchen sink"
MAP files were actually the bulk of my performance problems!
Unfortunately, since the basic MapServer debug output (to report layer
rendering times) is turned on by setting DEBUG ON in the MAP file, it's
not active for the loading of the MAP file itself.  Some simple changes
allowed me to see how much time was being spent actually loading the MAP
files.

In common situations, I had configurations in which the loading and
parsing of the MAP file was taking 7 times as long as drawing the map
did!

The best thing you can do is to completely eliminate unnecessary LAYER
definitions from your MAP file.  In your case, you seem to have layers
at different scales, such that certain groups of layers are used at
particular times and not at others.  Let's suppose you have three layers
named A, B, and C.  If only one of those layers is actually used at any
one time, then the "simple" approach is to put A, B, and C into one MAP
file with MINSCALE/MAXSCALE settings.  The faster way is to create three
separate MAP files, one with each of A, B, and C in it.  When you
generate the URL to request an image, you select which MAP file to use.

Obviously you need a MAP file with each combination of layers used at
the same time, or a way at the client end to overlay multiple MAP
requests.

As for using the C preprocessor to process #include and #define macros
in your MAP files, please check the archives, as my answer to that
question will be the same as it's been every few months for the past few
years <g>.

	- Ed

Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
ed at topozone.com
(978) 251-4242  

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Ed Dowding
Sent: Thursday, March 09, 2006 9:03 AM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: [UMN_MAPSERVER-USERS] How to avoide HUGE .map files

Does anyone have any advice on how to avoid huge .map files?

We have a flash interface to our mapserver app, and we have mapping for
the whole or europe (and much of america) down to building outline
level.

Our interface makes it possible to scroll the map from country to
country, and zoom in/out, so really all styling has to be in the one
file.

But...

1) Does it all have to be in that file? Am I right about this?

2) any tips on managing and styling them? I'm currently using jedit
since it has nice code folding. I'm yet to find a GUI that exports .map
files in a format that is immediately usable.

3) any other tips from anyone?

Thanks in advance,

Ed



More information about the mapserver-users mailing list