<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7226.0">
<TITLE>Hilight plugin performances</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<BR>

<P><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">Humm&#8230; , seemed never delivered to cartoweb user list&#8230; may be I have to repost it to dev list (??)</FONT>
</P>
<BR>

<P><FONT SIZE=2 FACE="Arial">Hi all,</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">I got some performance issues while using cartoweb with the hilight plugin activated and some large query selection :</FONT>

<BR><FONT SIZE=2 FACE="Arial">Under my config, with 400 points selected, the map refresh was about 50 seconds ( 500 points selected generate even a soap timeout at 60s).</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Apparently, the time is mainly spend in mapserver while displaying the dedicated &quot;XXX_hilight&quot; layer, since if I set 'drawQueryUsingHilight = false' in query.ini to disable the hilight, the same page refresh is about 10s only. </FONT></P>

<P><FONT SIZE=2 FACE="Arial">After some investigations, I found that CartoWeb forces dynamically a new EXPRESSION in the first class of the hilight layer, in the form : </FONT></P>

<P><B><FONT SIZE=2 FACE="Arial">EXPRESSION ( [idfield]=&quot;value1&quot; OR [idfield]=&quot;value2&quot; OR [idfield]=&quot;value3&quot; OR &#8230;OR [idfield]=&quot;value400&quot; )</FONT></B><FONT SIZE=2 FACE="Arial"> </FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">and I guess that mapserver got stuck to interpret this for wide list of values&#8230;</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">I don't know if this can help or not, but I found a way to speed</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial"></FONT> <FONT SIZE=2 FACE="Arial">up this process by moving this expression from the EXPRESSION field of the class to the DATA field of the layer: I modified the hilight plugin to dynamically write a new data string in the form:</FONT></P>

<P><FONT SIZE=2 FACE="Arial">$new_string = &quot;geom from (SELECT * from my_schema.table</FONT><B> <FONT SIZE=2 FACE="Arial">WHERE idfield=&quot;value1&quot; OR idfield=&quot;value2&quot; OR idfield=&quot;value3&quot; OR &#8230;OR idfield=&quot;value400&quot;</FONT></B><FONT SIZE=2 FACE="Arial"> ) AS foo USING UNIQUE idfield USING srid=-1&quot; </FONT></P>

<P><FONT SIZE=2 FACE="Arial">$msLayer-&gt;set(&quot;data&quot;, $new_string);</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">This is definitively faster and the draw time result is about the same as for the default mapserver hilite mode (i.e. 10s in my case).</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Using this, cartoweb displays about 5200 hilighted points in 50s.</FONT>
</P>

<P><FONT COLOR="#000000" SIZE=2 FACE="Arial">Now I am not sure this can be implemented in CartoWeb itself to improve hilight plugin performance, since it may be less generic that the current solution (if DATA fields of the layer to hilight are already complex for instance) but it can be implemented as an additional alternative if the user set a specific tag in his hilight layer data field to be replaced dynamicaly by the expression.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Regards,</FONT>

<BR><FONT SIZE=2 FACE="Arial">Franck</FONT>
</P>
<BR>

</BODY>
</HTML>