<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hello David,<br>
<br>
I wasn't aware of the "IN" syntax. It looks cleaner, and hopefully will
be better. I think in the end I will try all sollutions and see which
one is the fastest for a given (large) expression.<br>
<br>
Thangs again,<br>
Adrian<br>
<br>
Fawcett, David wrote:
<blockquote
 cite="mid:6246727221874A4FB8D3F9BBC37D9BD5056DA681@s-sp22.pca.state.mn.us"
 type="cite">
  <title>Message</title>
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta content="MSHTML 6.00.6000.16850" name="GENERATOR">
  <div><span class="881472713-14072009"><font color="#0000ff"
 face="Arial" size="2">Adrian, </font></span></div>
  <div><span class="881472713-14072009"></span> </div>
  <div><span class="881472713-14072009"><font color="#0000ff"
 face="Arial" size="2">One method that I have used is to use an IN
statement in my expression and then use a variable to populate the list
of IDs in the statement.  </font></span></div>
  <div><span class="881472713-14072009"></span> </div>
  <div><span class="881472713-14072009"><font color="#0000ff"
 face="Arial" size="2">I create a class like this:</font></span></div>
  <div><span class="881472713-14072009"></span> </div>
  <div><span class="881472713-14072009"><font color="#0000ff"
 face="Arial" size="2"> CLASS<br>
       NAME "Low"<br>
       EXPRESSION ('[COUNTY_FIP]' in '%group1%')<br>
       OUTLINECOLOR 0 0 0   <br>
       COLOR 255 204 204<br>
    END</font></span></div>
  <div><span class="881472713-14072009"></span> </div>
  <div><span class="881472713-14072009"><font color="#0000ff"
 face="Arial" size="2">And then in the URL calling the map, I include
&amp;group1=27001,27003,27005</font></span></div>
  <div><span class="881472713-14072009"></span> </div>
  <div><span class="881472713-14072009"><font color="#0000ff"
 face="Arial" size="2">I actually use this with five classes (five
different URL vars) to create a thematic map of counties based entirely
on data passed in through the URL.  </font></span></div>
  <div><span class="881472713-14072009"></span> </div>
  <div><span class="881472713-14072009"><font color="#0000ff"
 face="Arial" size="2">I have no idea on how the performance of this
method compares to what you have done, but it might be worth a try. 
There are only 87 counties in Minnesota, so that is the largest number
it gets, but the performance isn't bad.</font></span></div>
  <div><span class="881472713-14072009"></span> </div>
  <div><span class="881472713-14072009"><font color="#0000ff"
 face="Arial" size="2">David.</font></span></div>
  <blockquote style="margin-right: 0px;">
    <div class="OutlookMessageHeader" dir="ltr" align="left"
 lang="en-us"><font face="Tahoma" size="2">-----Original Message-----<br>
    <b>From:</b> <a class="moz-txt-link-abbreviated" href="mailto:mapserver-users-bounces@lists.osgeo.org">mapserver-users-bounces@lists.osgeo.org</a>
[<a class="moz-txt-link-freetext" href="mailto:mapserver-users-bounces@lists.osgeo.org">mailto:mapserver-users-bounces@lists.osgeo.org</a>] <b>On Behalf Of </b>Adrian
Popa<br>
    <b>Sent:</b> Tuesday, July 14, 2009 1:15 AM<br>
    <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
    <b>Subject:</b> [mapserver-users] Performance in regular
expressions or an alternative way to select a list of features<br>
    <br>
    </font></div>
Hello everyone,<br>
    <br>
Here's my problem: I'm trying to highlight segments from a line layer
by using an expression in a specific class. This portion of the mapfile
is dynamically generated and when it is done, it is sent to mapserver
for rendering. <br>
My problem is that I have to select between 10 - 400 features at a time
and I noticed when I have a lot of features there is a severe
performance degradation in mapserver (takes a lot of time to render or
even times out).<br>
Right now, my expression is built using regular expressions: something
like:<br>
    <b>EXPRESSION /^ITEM1$|^ITEM2$|^ITEM3$|^ITEM4$/</b><br>
This works ok, but as I said has a performance penalty when you reach
~400 items.  My data is selected from a shapefile layer which has about
5500 items.<br>
    <br>
Since I wouldn't be using the regular expressions at full capacity (I'm
matching the full name), I might rewrite the expression using something
like:<br>
    <b>EXPRESSION ( ([NAME]=="ITEM1") OR ([NAME]=="ITEM2") OR
([NAME]=="ITEM3") OR ([NAME]=="ITEM4") )</b><br>
    <br>
From the documentation I see that:<br>
    <i>Regular expression with MapServer work similarly to string
comparison, but allow more complex operation. They are slower than pure
string comparisons, but might be still faster than logical expression.
As with the string comparison use regular expressions, a FILTERITEM or
a CLASSITEM has to defined, respectively.<br>
    <br>
    </i>I would like to know if there is an efficient way of selecting
a list of elements from a layer, or what are your recommendations.<br>
    <br>
Also - have there been significant changes in performance for this
issue from mapserver 4.10 (I am now migrating to mapserver 5.4)?<br>
    <br>
Thanks,<br>
Adrian<br>
    <br>
  </blockquote>
</blockquote>
<br>
</body>
</html>