<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none"><!--P{margin-top:0;margin-bottom:0;} .ms-cui-menu {background-color:#ffffff;border:1px rgb(171, 171, 171) solid;font-family:"Segoe UI WPC","Segoe UI",Tahoma,"Microsoft Sans Serif",Verdana,sans-serif;font-size:10pt;color:rgb(51, 51, 51);} .ms-cui-menusection-title {display:none;} .ms-cui-ctl {vertical-align:text-top;text-decoration:none;color:rgb(51, 51, 51);} .ms-cui-ctl-on {background-color:rgb(223, 237, 250);opacity: 0.8;} .ms-cui-img-cont-float {display:inline-block;margin-top:2px} .ms-cui-smenu-inner {padding-top:0px;} .ms-owa-paste-option-icon {margin: 2px 4px 0px 4px;vertical-align:sub;padding-bottom: 2px;display:inline-block;} .ms-rtePasteFlyout-option:hover {background-color:rgb(223, 237, 250) !important;opacity:1 !important;} .ms-rtePasteFlyout-option {padding:8px 4px 8px 4px;outline:none;} .ms-cui-menusection {float:left; width:85px;height:24px;overflow:hidden}--></style>
</head>
<body>
<div style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi,</p>
<p><br>
</p>
<p>TinyOWS is creating good SQL requests as far as I know. Send me some complete HTTP POST GetFeature so I can modify it and see from my TinyOWS and PostGIS logs what really happens.<br>
</p>
<p><br>
</p>
<p>-Jukka Rahkonen-<br>
</p>
<div style="color: #282828;">
<hr tabindex="-1" style="display: inline-block; width: 98%;">
<div dir="ltr" id="divRplyFwdMsg"><font face="Calibri, sans-serif" color="#000000" style="font-size: 11pt;">Steve Toutant wrote:</font>
<div> </div>
</div>
<div><font face="sans-serif" size="2">Until mapserver 7, Do you know if tinyows is doing things the same way?</font>
<br>
<font face="sans-serif" size="2">I tried but could not get tinyows working yet.</font>
<p></p>
<p><br>
<br>
<br>
<table width="100%" style="border-collapse: collapse;">
<tbody>
<tr valign="top" height="8">
<td width="40%" style="border-style: none; border-color: #000000; border-width: 0px; padding: 0px;">
<font face="sans-serif" size="1"><b>Stephen Woodbridge <woodbri@swoodbridge.com></b>
</font>
<p><font face="sans-serif" size="1">2015-01-26 16:10</font> </p>
</td>
<td width="59%" style="border-style: none; border-color: #000000; border-width: 0px; padding: 0px;">
<table width="100%" style="border-collapse: collapse;">
<tbody>
<tr valign="top" height="21">
<td width="57" style="border-style: none; border-color: #000000; border-width: 0px; padding: 0px;">
<div align="right"><font face="sans-serif" size="1">A</font></div>
</td>
<td style="border-style: none; border-color: #000000; border-width: 0px; padding: 0px;">
<font face="sans-serif" size="1">Steve.Toutant@inspq.qc.ca</font> </td>
</tr>
<tr valign="top" height="21">
<td width="57" style="border-style: none; border-color: #000000; border-width: 0px; padding: 0px;">
<div align="right"><font face="sans-serif" size="1">cc</font></div>
</td>
<td style="border-style: none; border-color: #000000; border-width: 0px; padding: 0px;">
<font face="sans-serif" size="1">mapserver-users@lists.osgeo.org, mapserver-users-bounces@lists.osgeo.org</font>
</td>
</tr>
<tr valign="top" height="21">
<td width="57" style="border-style: none; border-color: #000000; border-width: 0px; padding: 0px;">
<div align="right"><font face="sans-serif" size="1">Objet</font></div>
</td>
<td style="border-style: none; border-color: #000000; border-width: 0px; padding: 0px;">
<font face="sans-serif" size="1">Re: [mapserver-users] Mapserver doesn't send good filter to postgis</font></td>
</tr>
</tbody>
</table>
<br>
<table width="393" style="border-collapse: collapse;">
<tbody>
<tr valign="top" height="8">
<td width="57" style="border-style: none; border-color: #000000; border-width: 0px; padding: 0px;">
</td>
<td width="336" style="border-style: none; border-color: #000000; border-width: 0px; padding: 0px;">
</td>
</tr>
</tbody>
</table>
<br>
</td>
</tr>
</tbody>
</table>
<br>
<br>
<br>
<br>
<br>
<tt><font size="2">On 1/26/2015 2:12 PM, Steve.Toutant@inspq.qc.ca wrote:<br>
> Thanks for your explanation Stephen.<br>
> I'm sure there were good reasons to do that, but it is a weird way of<br>
> filtering.<br>
<br>
It is a legacy issue the RFC 91 I think is trying to clean up. Mapserver <br>
started with rasters and shapefiles, so everything had to be done in <br>
mapserver. As it grew to support more data sources things have changes <br>
and we are trying to push this kind of filtering back into the data <br>
sources where it can be done efficiently, while still allow other data <br>
sources that do not support the native filtering to work also work by <br>
having a generic filing ability still built into mapserver.<br>
<br>
Steve W<br>
<br>
> I Cannot use the bbox of the window but as you suggest, passing the bbox<br>
> of the geometry could be a workaround.<br>
><br>
> If someone as an idea on how we could pass the bbox of the geometry to<br>
> mapserver or any other ideas it would be much appreciated.<br>
><br>
> Is this issue will really be improved in mapserver 7 for postgis and<br>
> oracle? When is it scheduled?<br>
><br>
> thanks again for your help!<br>
><br>
> steve<br>
><br>
><br>
><br>
><br>
> *Stephen Woodbridge <woodbri@swoodbridge.com>@lists.osgeo.org*<br>
> Envoyé par : mapserver-users-bounces@lists.osgeo.org<br>
><br>
> 2015-01-26 11:31<br>
><br>
>                  <br>
> A<br>
>                  mapserver-users@lists.osgeo.org<br>
> cc<br>
>                  <br>
> Objet<br>
>                  Re: [mapserver-users] Mapserver doesn't send good filter to postgis<br>
><br>
><br>
>                  <br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> Steve T.,<br>
><br>
> mapserver gets back all the geometries from postgis and then filters<br>
> them in mapserver against the geometry.<br>
><br>
> Mapserver passes the BBOX for the mapfile to postgis as you noticed<br>
> which is not very efficient, but you can override that to the BBOX of<br>
> the window using the BBOX substitution variable in the SQL, but this<br>
> might not be what you want if you geometry is off screen.<br>
><br>
> I'm not aware of any way to pass the BBOX of the geometry.<br>
><br>
> Steve L - can we do this?<br>
><br>
> So currently, your wfs requests are getting filtered against the<br>
> geometry. And there is room for efficiency improvements.<br>
><br>
> -Steve W<br>
><br>
> On 1/26/2015 11:15 AM, Steve.Toutant@inspq.qc.ca wrote:<br>
>  > sorry I'm confused, perhaps I misunderstand what you explained.  I don't<br>
>  > understand what you mean by "MapServer does use the supplied geometry,<br>
>  > it’s a matter of where the filter is applied – the database or in<br>
>  > MapServer"<br>
>  ><br>
>  > In mapserver log I see<br>
>  ><br>
>  > FLTLayerApplyPlainFilterToLayer():  ([shape]  within  fromText('POLYGON<br>
>  > ((-8081644.2511243997141719 5835062.5699599999934435,<br>
>  > -8081707.5505384001880884 5834980.1612889003008604,<br>
>  > -8081638.2794815003871918 5834913.2788891997188330,<br>
>  > -8081533.1785677000880241 5834988.5215889001265168,<br>
>  > -8081644.2511243997141719 5835062.5699599999934435))'))<br>
>  ><br>
>  > So this is good, but<br>
>  > A few lines later in the mapserver log, I see that it is not sending the<br>
>  > supplied geometry as filter, it is sending the extent of the mapfile<br>
>  > select .......  where geom_p && ST_GeomFromText('POLYGON((-9239517<br>
>  > 5465442,-9239517 9349764,-5565974 9349764,-5565974 5465442,-9239517<br>
>  > 5465442))',3857);<br>
>  ><br>
>  > So it received the supplied geometry, but it is not using it....<br>
>  ><br>
>  > If only BBOX can be used as a spatial operator, it is not good for our<br>
>  > needs. We really need to know what features are inside a user defined<br>
>  > polygon.<br>
>  ><br>
>  ><br>
>  ><br>
>  ><br>
>  > *"Lime, Steve D (MNIT)" <Steve.Lime@state.mn.us>*<br>
>  ><br>
>  > 2015-01-26 10:56<br>
>  ><br>
>  ><br>
>  > A<br>
>  >                  "Steve.Toutant@inspq.qc.ca" <Steve.Toutant@inspq.qc.ca><br>
>  > cc<br>
>  >                  "mapserver-users@lists.osgeo.org"<br>
> <mapserver-users@lists.osgeo.org><br>
>  > Objet<br>
>  >                  RE: [mapserver-users] Mapserver doesn't send good<br>
> filter to postgis<br>
>  ><br>
>  ><br>
>  ><br>
>  ><br>
>  ><br>
>  ><br>
>  ><br>
>  ><br>
>  ><br>
>  ><br>
>  > MapServer does use the supplied geometry, it’s a matter of where the<br>
>  > filter is applied – the database or in MapServer. This isn’t a new<br>
>  > limitation so others may have more experience with workarounds. Maybe<br>
>  > try also setting a bbox in the filter based on the bbox of the geometry?<br>
>  ><br>
>  > Steve<br>
>  ><br>
>  > *From:* Steve.Toutant@inspq.qc.ca [</font></tt><a href="mailto:Steve.Toutant@inspq.qc.ca"><tt><font size="2">mailto:Steve.Toutant@inspq.qc.ca</font></tt></a><tt><font size="2">] *<br>
>  > Sent:* Monday, January 26, 2015 9:38 AM*<br>
>  > To:* Lime, Steve D (MNIT)*<br>
>  > Cc:* mapserver-users@lists.osgeo.org*<br>
>  > Subject:* RE: [mapserver-users] Mapserver doesn't send good filter to<br>
>  > postgis<br>
>  ><br>
>  > I understand the objective of rfc 91, but the most common use case would<br>
>  > be to pass the supplied geometry.....<br>
>  ><br>
>  > If mapserver doesn't use the supplied geometry, that means that it<br>
>  > doesn't support spatial filtering.<br>
>  ><br>
>  > Our data covers the whole country, not using the supplied geometry means<br>
>  > we can't use mapserver as a wfs server....<br>
>  ><br>
>  > Is there something we can do about it? A workaround we could use?<br>
>  ><br>
>  ><br>
>  > *"Lime, Steve D (MNIT)" <**_Steve.Lime@state.mn.us_*<br>
>  > <</font></tt><a href="mailto:Steve.Lime@state.mn.us"><tt><font size="2">mailto:Steve.Lime@state.mn.us</font></tt></a><tt><font size="2">>*>*<br>
>  ><br>
>  > 2015-01-26 10:14<br>
>  ><br>
>  ><br>
>  > A<br>
>  >                  "_Steve.Toutant@inspq.qc.ca_<br>
> <</font></tt><a href="mailto:Steve.Toutant@inspq.qc.ca"><tt><font size="2">mailto:Steve.Toutant@inspq.qc.ca</font></tt></a><tt><font size="2">>"<br>
>  > <_Steve.Toutant@inspq.qc.ca_ <</font></tt><a href="mailto:Steve.Toutant@inspq.qc.ca"><tt><font size="2">mailto:Steve.Toutant@inspq.qc.ca</font></tt></a><tt><font size="2">>>,<br>
>  > "_mapserver-users@lists.osgeo.org_<br>
>  > <</font></tt><a href="mailto:mapserver-users@lists.osgeo.org"><tt><font size="2">mailto:mapserver-users@lists.osgeo.org</font></tt></a><tt><font size="2">>"<br>
>  > <_mapserver-users@lists.osgeo.org_<br>
>  > <</font></tt><a href="mailto:mapserver-users@lists.osgeo.org"><tt><font size="2">mailto:mapserver-users@lists.osgeo.org</font></tt></a><tt><font size="2">>><br>
>  > cc<br>
>  ><br>
>  > Objet<br>
>  >                  RE: [mapserver-users] Mapserver doesn't send good<br>
> filter to postgis<br>
>  ><br>
>  ><br>
>  ><br>
>  ><br>
>  ><br>
>  ><br>
>  ><br>
>  ><br>
>  ><br>
>  ><br>
>  ><br>
>  > It’s a limitation in older versions of MapServer where specific backend<br>
>  > optimizations were scattered about the WMS/WFS code. Most of those<br>
>  > optimizations address the most common use cases – I guess this wasn’t<br>
>  > one of them. It’s surprising that at worst the extent of the supplied<br>
>  > geometry isn’t passed (I see a comment in the WFS code about this). The<br>
>  > specific filter intersection test is applied on the MapServer side – the<br>
>  > results are correct, performance can suffer though.<br>
>  ><br>
>  > This is being addresses in MapServer 7.0 where more complete filter<br>
>  > translation functions are being supported (RFC 91).<br>
>  ><br>
>  > Steve<br>
>  > *<br>
>  > From:* _mapserver-users-bounces@lists.osgeo.org_<br>
>  > <</font></tt><a href="mailto:mapserver-users-bounces@lists.osgeo.org"><tt><font size="2">mailto:mapserver-users-bounces@lists.osgeo.org</font></tt></a><tt><font size="2">><br>
>  > [_mailto:mapserver-users-bounces@lists.osgeo.org_] *On Behalf Of<br>
>  > *_Steve.Toutant@inspq.qc.ca_ <</font></tt><a href="mailto:Steve.Toutant@inspq.qc.ca"><tt><font size="2">mailto:Steve.Toutant@inspq.qc.ca</font></tt></a><tt><font size="2">>*<br>
>  > Sent:* Monday, January 26, 2015 8:55 AM*<br>
>  > To:* _mapserver-users@lists.osgeo.org_<br>
>  > <</font></tt><a href="mailto:mapserver-users@lists.osgeo.org"><tt><font size="2">mailto:mapserver-users@lists.osgeo.org</font></tt></a><tt><font size="2">>*<br>
>  > Subject:* [mapserver-users] Mapserver doesn't send good filter to postgis<br>
>  ><br>
>  > Sorry my first post was with an inapprpriate title......<br>
>  ><br>
>  > I'm using mapserver 6.4.1 and postgis 2.1<br>
>  ><br>
>  > using OpenLayers 2.13.1 I draw a small polygon that I use for a within<br>
>  > spatial filter of a WFS getfeature request. The problem is that<br>
>  > mapserver is not sending this polygon to postgis, it is sending the<br>
>  > extent of the mapfile as filter...<br>
>  ><br>
>  > The wfs POST Request (created and send by OpenLayers client)<br>
>  > <ogc:Filter<br>
>  ><br>
> xmlns:ogc="_http://www.opengis.net/ogc_"><ogc:Within><ogc:PropertyName>msGeometry</ogc:PropertyName><gml:Polygon<br>
>  > xmlns:gml="_http://www.opengis.net/gml_"<br>
>  ><br>
> srsName="urn:ogc:def:crs:EPSG::3857"><gml:exterior><gml:LinearRing><gml:posList>-8081644.2511244<br>
>  > 5835062.56996 -8081707.5505384 5834980.1612889 -8081638.2794815<br>
>  > 5834913.2788892 -8081533.1785677 5834988.5215889 -8081644.2511244<br>
>  ><br>
> 5835062.56996</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></ogc:Within></ogc:Filter><br>
>  ><br>
>  ><br>
>  > In Mapserver log, I see<br>
>  > FLTLayerApplyPlainFilterToLayer():  ([shape]  within  fromText('POLYGON<br>
>  > ((-8081644.2511243997141719 5835062.5699599999934435,<br>
>  > -8081707.5505384001880884 5834980.1612889003008604,<br>
>  > -8081638.2794815003871918 5834913.2788891997188330,<br>
>  > -8081533.1785677000880241 5834988.5215889001265168,<br>
>  > -8081644.2511243997141719 5835062.5699599999934435))'))<br>
>  ><br>
>  > Then a few lines later, I see that it is not sending the polygon<br>
>  > received as filter<br>
>  > select .......  where geom_p && ST_GeomFromText('POLYGON((-9239517<br>
>  > 5465442,-9239517 9349764,-5565974 9349764,-5565974 5465442,-9239517<br>
>  > 5465442))',3857);<br>
>  ><br>
>  > See the polygon definition is different, postgis receive the extent<br>
>  > defined in the mapfile<br>
>  > EXTENT -9239517 5465442 -5565974 9349764<br>
>  ><br>
>  ><br>
>  > And, in postgis log I see this query, See the<br>
>  > select ....... where geom_p && ST_GeomFromText('POLYGON((-9239517<br>
>  > 5465442,-9239517 9349764,-5565974 9349764,-5565974 5465442,-9239517<br>
>  > 5465442))',3857);<br>
>  ><br>
>  ><br>
>  > Why Mapserver is not sending the polygon received as filter to postgis?<br>
>  ><br>
>  ><br>
>  > Thanks!<br>
>  ><br>
>  > /Steve Toutant, M. Sc./<br>
>  > Analyste en géomatique<br>
>  > Secteur environnement<br>
>  > Direction de la santé environnementale et de la toxicologie<br>
>  > Institut national de santé publique du Québec<br>
>  > Tél.: 418 646-6777 poste 30015<br>
>  > Téléc.: 418 644-4593_<br>
>  > __steve.toutant@inspq.qc.ca_ <</font></tt><a href="mailto:steve.toutant@inspq.qc.ca"><tt><font size="2">mailto:steve.toutant@inspq.qc.ca</font></tt></a><tt><font size="2">>_<br>
>  > __http://www.inspq.qc.ca_ <</font></tt><a href="http://www.inspq.qc.ca/"><tt><font size="2">http://www.inspq.qc.ca/</font></tt></a><tt><font size="2">>_<br>
>  > __http://www.monclimatmasante.qc.ca_ <</font></tt><a href="http://www.monclimatmasante.qc.ca/"><tt><font size="2">http://www.monclimatmasante.qc.ca/</font></tt></a><tt><font size="2">><br>
>  ><br>
>  > /Pour me rejoindre par courrier/<br>
>  > Service de l'infrastructure et du réseau<br>
>  > Direction des technologies de l'information<br>
>  > Ministère de la Sécurité Publique<br>
>  > 2525 boul. Laurier, 2e étage<br>
>  > Tour Laurentides<br>
>  > Québec, G1V 2L2<br>
>  ><br>
>  ><br>
>  ><br>
>  ><br>
>  ><br>
>  > _______________________________________________<br>
>  > mapserver-users mailing list<br>
>  > mapserver-users@lists.osgeo.org<br>
>  > </font></tt><a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users"><tt><font size="2">http://lists.osgeo.org/mailman/listinfo/mapserver-users</font></tt></a><tt><font size="2"><br>
>  ><br>
><br>
> _______________________________________________<br>
> mapserver-users mailing list<br>
> mapserver-users@lists.osgeo.org<br>
> </font></tt><a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users"><tt><font size="2">http://lists.osgeo.org/mailman/listinfo/mapserver-users</font></tt></a><tt><font size="2"><br>
><br>
><br>
><br>
<br>
</font></tt><br>
<br>
<br>
</p>
</div>
</div>
</div>
</body>
</html>