<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16850" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV><SPAN class=881472713-14072009><FONT face=Arial color=#0000ff 
size=2>Adrian, </FONT></SPAN></DIV>
<DIV><SPAN class=881472713-14072009><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=881472713-14072009><FONT face=Arial color=#0000ff 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.&nbsp; 
</FONT></SPAN></DIV>
<DIV><SPAN class=881472713-14072009><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=881472713-14072009><FONT face=Arial color=#0000ff size=2>I 
create a class like this:</FONT></SPAN></DIV>
<DIV><SPAN class=881472713-14072009><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=881472713-14072009><FONT face=Arial color=#0000ff 
size=2>&nbsp;CLASS<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NAME 
"Low"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXPRESSION ('[COUNTY_FIP]' in 
'%group1%')<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OUTLINECOLOR 0 0 
0&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLOR 255 204 
204<BR>&nbsp;&nbsp;&nbsp; END</FONT></SPAN></DIV>
<DIV><SPAN class=881472713-14072009><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=881472713-14072009><FONT face=Arial color=#0000ff 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><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=881472713-14072009><FONT face=Arial color=#0000ff 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.&nbsp; 
</FONT></SPAN></DIV>
<DIV><SPAN class=881472713-14072009><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=881472713-14072009><FONT face=Arial color=#0000ff 
size=2>I&nbsp;have no idea on how the performance of this method compares to 
what you have done, but it might be worth a try.&nbsp; 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><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=881472713-14072009><FONT face=Arial color=#0000ff 
size=2>David.</FONT></SPAN></DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT 
  face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> 
  mapserver-users-bounces@lists.osgeo.org 
  [mailto:mapserver-users-bounces@lists.osgeo.org] <B>On Behalf Of </B>Adrian 
  Popa<BR><B>Sent:</B> Tuesday, July 14, 2009 1:15 AM<BR><B>To:</B> 
  mapserver-users@lists.osgeo.org<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.&nbsp; 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></BODY></HTML>