<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="City"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="place"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:black;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body bgcolor=white lang=EN-GB link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Hi Adrian,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I have used long EXPRESSION list in the
past, but my data are &#8220;static&#8221;, so eventually I modified the map
data and removed the polygons I didn&#8217;t want to render.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I could suggest to you to use in your map
file several LAYERs or CLASSes to &#8220;spread around&#8221; long EXPRESSION
lists. Those LAYERs or CLASSes would be identical but for the EXPRESSION lists.&nbsp;
You could put a limit of let&#8217;s say 10 selected features per CLASS
definition.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Best regards,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Nick<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
color=black face="Times New Roman"><span lang=EN-US style='font-size:12.0pt;
color:windowtext'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 color=black face=Tahoma><span lang=EN-US
style='font-size:10.0pt;font-family:Tahoma;color:windowtext;font-weight:bold'>From:</span></font></b><font
size=2 color=black face=Tahoma><span lang=EN-US style='font-size:10.0pt;
font-family:Tahoma;color:windowtext'> mapserver-users-bounces@lists.osgeo.org
[mailto:mapserver-users-bounces@lists.osgeo.org] <b><span style='font-weight:
bold'>On Behalf Of </span></b>Adrian Popa<br>
<b><span style='font-weight:bold'>Sent:</span></b> 14 July 2009 07:15<br>
<b><span style='font-weight:bold'>To:</span></b>
mapserver-users@lists.osgeo.org<br>
<b><span style='font-weight:bold'>Subject:</span></b> [mapserver-users]
Performance in regular expressions or an alternative way to select a list of
features</span></font><font color=black><span lang=EN-US style='color:windowtext'><o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt'>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><span style='font-weight:bold'>EXPRESSION /^ITEM1$|^ITEM2$|^ITEM3$|^ITEM4$/</span></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><span style='font-weight:bold'>EXPRESSION ( ([NAME]==&quot;ITEM1&quot;) OR
([NAME]==&quot;ITEM2&quot;) OR ([NAME]==&quot;ITEM3&quot;) OR
([NAME]==&quot;ITEM4&quot;) )</span></b><br>
<br>
>From the documentation I see that:<br>
<i><span style='font-style:italic'>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>
</span></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>
<st1:City w:st="on"><st1:place w:st="on">Adrian</st1:place></st1:City><o:p></o:p></span></font></p>

</div>

</body>

</html>