conditional/regular expressions are slow

Dylan Keon dbkeon.ml at GMAIL.COM
Fri Aug 5 20:48:29 EDT 2005


On 08/05/2005 05:07 PM, Douglass Davis wrote:
> Also, the highways are numbered A1.* and A2.* for the big highways A3.* 
> for the smaller highways etc.  So, What I do is use regular expressions 
> like:
> 
>      EXPRESSION /A[12].*/
>      EXPRESSION /A[3].*/
> 
> This appears to be slowing things down.  What's the best way to handle 
> this?

I haven't tested this, but I wonder if /^A[12]/ and /^A3/ would be any 
faster.

> Three ideas I have for speeding this up are:
> 1. Export the shapefile to PostGIS where it can be indexed correctly
> 2. Separate the shapefile into multiple shapefiles somehow.  One file 
> would have big cities, the next file would have medium size cities and 
> big cities etc.
> 3. Somehow add more indexing to the shapefile.

Try creating spatial indexes on your shapefiles if you haven't done so 
already.  Use the shptree utility that is packaged with MapServer.

--Dylan



More information about the mapserver-users mailing list