<font size=2 face="sans-serif">Thanks for your explanation Stephen.</font>
<br><font size=2 face="sans-serif">I'm sure there were good reasons to
do that, but it is a weird way of filtering.</font>
<br>
<br><font size=2 face="sans-serif">I Cannot use the bbox of the window
but as you suggest, passing the bbox of the geometry could be a workaround</font><tt><font size=3>.</font></tt>
<p><font size=2 face="sans-serif">If someone as an idea on how we could
pass the bbox of the geometry to mapserver or any other ideas it would
be much appreciated.</font>
<p><font size=2 face="sans-serif">Is this issue will really be improved
in mapserver 7 for postgis and oracle? When is it scheduled?</font>
<p><font size=2 face="sans-serif">thanks again for your help!</font>
<p><font size=2 face="sans-serif">steve</font>
<p>
<br>
<br>
<br>
<table width=100% style="border-collapse:collapse;">
<tr valign=top height=8>
<td width=40% style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><font size=1 face="sans-serif"><b>Stephen
Woodbridge <woodbri@swoodbridge.com>@lists.osgeo.org</b> </font>
<br><font size=1 face="sans-serif">Envoyé par : mapserver-users-bounces@lists.osgeo.org</font>
<p><font size=1 face="sans-serif">2015-01-26 11:31</font>
<td width=59% style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;">
<table width=100% style="border-collapse:collapse;">
<tr valign=top height=21>
<td width=57 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;">
<div align=right><font size=1 face="sans-serif">A</font></div>
<td style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><font size=1 face="sans-serif">mapserver-users@lists.osgeo.org</font>
<tr valign=top height=21>
<td width=57 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;">
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;">
<tr valign=top height=21>
<td width=57 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;">
<div align=right><font size=1 face="sans-serif">Objet</font></div>
<td style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><font size=1 face="sans-serif">Re:
[mapserver-users] Mapserver doesn't send good filter to postgis</font></table>
<br>
<table width=393 style="border-collapse:collapse;">
<tr valign=top height=8>
<td width=57 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;">
<td width=336 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"></table>
<br></table>
<br>
<br>
<br>
<br>
<br><tt><font size=2>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"
<mapserver-users@lists.osgeo.org><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>
> 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_
<</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 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>
> 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>
> 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>
> 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>
</font></tt>
<br>
<br>
<br>