Streets and streets' labels drawing performance

Stephen Woodbridge woodbri at SWOODBRIDGE.COM
Thu Apr 5 19:39:00 EDT 2007


Rodrigo, Jeff, Gregor,

It is possible to do this without too much effort. I do it with Tiger 
Data and I have 3300 counties with the street data split into Major 
roads and Minor roads.

See here for what you can expect:
http://imaptools.com/maps/demo.html

Some of the tricks are:

Don't you shapefiles with 800000 lines in it. Use shape2tile (you can 
get it from the downloads section of http://imaptools.com/ to split you 
big shapefiles into smaller ones using quadtree option to put 8-10K 
items per file. Then use create a tileindex to seem the files back together.

Use mindistance in the label block to avoid drawing extra labels.

Build mapserver with the -debug configure option and set DEBUG ON in 
your mapfile and look at the apache errorlog to see what layers are 
costing the most to draw and optimize them first. Turn them on later 
with MIN/MAXSCALE. Look at the labelcache performance if this is too 
high reduce the number of labels you are adding to the cache by turning 
on labels later with MIN/MAXSCALE

MAKE SURE ALL shapefiles have a spatial index using shptree. On linux run:

find /path/to/data -name \*.shp -exec shptree {} \;

make sure you tileindexes all have shptree indexes.

There are probably a few more but this is good for starters.

-Steve

Rodrigo Del C. Andrade wrote:
>    Hello dear list.
>    Quick and (hopefully) simple question:
>      What are the big mapscript no-no's for the performance conscious 
> coder?
>    I'll explain. I am working on a java mapscript application that only 
> show cities and streets. Using maxscale to draw the cities streets only 
> at certain zoom lvls and the street labels even closer.
>    But the performance is a huge problem when it tries to render the 
> streets and the accompanying labels. And I mean it, the server bends and 
> stays on its knees for minutes while I wait for the map to show. I've 
> banished antialising from the code, caching and all the bells and 
> whistles, but the performance is still atrocious. Whats more strange, 
> some areas of the map (it is composed of several shapefiles defined in 
> its own layer and mapfile, included into the main mapfile) have 
> acceptable performance, so could something in the shapefiles being 
> slowing render draw? They all come from the same source and seem to have 
> the same structure, so what could I look for in them that would hamper 
> its drawing speed?
> 
>    Any help is hugely appreciated.
>    Thanks
> 



More information about the mapserver-users mailing list