conditional/regular expressions are slow
Douglass Davis
douglass_davis at EARTHLINK.NET
Fri Aug 5 17:07:13 PDT 2005
I have an application which allows me to have about 5 different zoom levels.
From the lowest zoom level, you can see the biggest cities only. Az
you zoom in, can see the biggest highways, then small highways, then
small streets.
The way I do this is in my mapfile I have:
LAYER
NAME big_cities
...
CLASS
NAME big_city_class
EXPRESSION ('[POP_2000]'>80000 and '[STATE]'='NC')
...
I am only interested in North Carolina by the way.
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?
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.
Neither of which I know how to do.
Does any one have any idea of how to do any of these things? I would
prefer using some kind of free tool... Even a command line one would be
fine, as I do not have a big budget.
--
http://www.douglassdavis.com
More information about the MapServer-users
mailing list