<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@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:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></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 lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">I would expect to see a bbox query using the bbox of your search shape. That would then identify candidate shapes, likely a much smaller set, for which actual
 intersection tests are done. I&#8217;ll defer to the WFS devs for a bit more insight.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Steve<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> Marc-André Trottier [mailto:trottier.marcandre@gmail.com]
<br>
<b>Sent:</b> Wednesday, November 30, 2011 12:28 PM<br>
<b>To:</b> Lime, Steve D (DNR); mapserver-users@lists.osgeo.org<br>
<b>Subject:</b> Re: [mapserver-users] wfs request getfeature with polygon<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">there is my POST : <br>
<br>
<code><span style="font-size:10.0pt">&lt;wfs:GetFeature xmlns:wfs=&quot;<a href="http://www.opengis.net/wfs">http://www.opengis.net/wfs</a>&quot; service=&quot;WFS&quot; version=&quot;1.1.0&quot; xsi:schemaLocation=&quot;<a href="http://www.opengis.net/wfs">http://www.opengis.net/wfs</a>
<a href="http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">http://schemas.opengis.net/wfs/1.1.0/wfs.xsd</a>&quot; xmlns:xsi=&quot;<a href="http://www.w3.org">http://www.w3.org</a>/2001/XMLSchema-instance&quot;&gt;&lt;wfs:Query typeName=&quot;ms:MSSS_SGS_P&quot; srsName=&quot;EPSG:32198&quot;&gt;&lt;ogc:Filter
 xmlns:ogc=&quot;<a href="http://www.opengis.net/ogc">http://www.opengis.net/ogc</a>&quot;&gt;&lt;ogc:Intersects&gt;&lt;ogc:PropertyName&gt;geometry&lt;/ogc:PropertyName&gt;&lt;gml:Polygon xmlns:gml=&quot;<a href="http://www.opengis.net/gml">http://www.opengis.net/gml</a>&quot; srsName=&quot;EPSG:32198&quot;&gt;&lt;gml:exterior&gt;&lt;gml:LinearRing&gt;&lt;gml:posList&gt;-206501.9511156373
 322690.6403888138 -222920.53608453833 315197.18794487417 -217872.36749086587 305166.3182788128 -205933.97268351325 315573.2833999051 -206501.9511156373 322690.6403888138&lt;/gml:posList&gt;&lt;/gml:LinearRing&gt;&lt;/gml:exterior&gt;&lt;/gml:Polygon&gt;&lt;/ogc:Intersects&gt;&lt;/ogc:Filter&gt;&lt;/wfs:Query&gt;&lt;/wfs:GetFeature&gt;</span></code><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;"><br>
<br>
<code>we got some performance issues with 4 millions features.</code><br>
<br>
</span><o:p></o:p></p>
<div>
<p class="MsoNormal">2011/11/30 Lime, Steve D (DNR) &lt;<a href="mailto:Steve.Lime@state.mn.us">Steve.Lime@state.mn.us</a>&gt;<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">What exactly is the WFS filter being used? Only certain queries are done wholly in the database.
 Most often bbox tests</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">are done in the database with other work done in MapServer.&nbsp; We hope to move more load off to the
 database</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">eventually. Are you seeing performance issues?</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Steve</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;</span><o:p></o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">
<a href="mailto:mapserver-users-bounces@lists.osgeo.org" target="_blank">mapserver-users-bounces@lists.osgeo.org</a> [mailto:<a href="mailto:mapserver-users-bounces@lists.osgeo.org" target="_blank">mapserver-users-bounces@lists.osgeo.org</a>]
<b>On Behalf Of </b>Marc-André Trottier<br>
<b>Sent:</b> Tuesday, November 29, 2011 5:06 PM</span><o:p></o:p></p>
<div>
<p class="MsoNormal"><br>
<b>To:</b> <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<b>Subject:</b> [mapserver-users] wfs request getfeature with polygon<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></o:p></p>
<p>! i'm doing a WFS GetFeature request with a polygon.<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><br>
Usually everything is fine. <br>
but for one table a got a enconding error with my data. (my problem) and the mapserver's log give me this SQL :<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p>select &quot;nom&quot;,&quot;adresse&quot;,&quot;postal&quot;,&quot;code&quot;,&quot;telephone&quot;,&quot;postal0&quot;,&quot;etab_code&quot;,&quot;etab_nom&quot;,&quot;rss_code&quot;,&quot;rss_nom&quot;,&quot;rls_code&quot;,&quot;rls_nom&quot;,&quot;clsc_code&quot;,&quot;clsc_nom&quot;,&quot;mun_code&quot;,&quot;mun_nom&quot;,&quot;longitude&quot;,&quot;latitude&quot;,&quot;sgs&quot;,&quot;hsld&quot;,&quot;clsc&quot;,&quot;pdi&quot;,&quot;pdp&quot;,&quot;pat&quot;,&quot;cj&quot;,&quot;sp&quot;,&quot;objectid&quot;,&quot;nom_commun&quot;,encode(ST_AsBinary(ST_Force_2D(&quot;geom_p&quot;),'NDR'),'hex')
 as geom,&quot;objectid&quot; from msss_v_sgs_p where geom_p &amp;&amp; GeomFromText('POLYGON((-1100000 -23500,-1100000 2253500,1100000 2253500,1100000 -23500,-1100000 -23500))',find_srid('','msss_v_sgs_p','geom_p'))<o:p></o:p></p>
<p>So my question, Why is mapserver does a spatial query with the layer's extent?<br>
with a table of 2millions features, that,s very slow even with a spatial index<o:p></o:p></p>
<p>marc-andre trottier<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</body>
</html>