Re: [mapserver-users] Mapserver doesn't send good filter to postgis

2015-01-26 Thread Steve . Toutant
I understand the objective of rfc 91, but the most common use case would 
be to pass the supplied geometry.
If mapserver doesn't use the supplied geometry, that means that it doesn't 
support spatial filtering. 
Our data covers the whole country, not using the supplied geometry means 
we can't use mapserver as a wfs server
Is there something we can do about it? A workaround we could use?







Lime, Steve D (MNIT) steve.l...@state.mn.us 
2015-01-26 10:14

A
steve.tout...@inspq.qc.ca steve.tout...@inspq.qc.ca, 
mapserver-users@lists.osgeo.org mapserver-users@lists.osgeo.org
cc

Objet
RE: [mapserver-users] Mapserver doesn't send good filter to postgis








It?s a limitation in older versions of MapServer where specific backend 
optimizations were scattered about the WMS/WFS code. Most of those 
optimizations address the most common use cases ? I guess this wasn?t one 
of them. It?s surprising that at worst the extent of the supplied geometry 
isn?t passed (I see a comment in the WFS code about this). The specific 
filter intersection test is applied on the MapServer side ? the results 
are correct, performance can suffer though.
 
This is being addresses in MapServer 7.0 where more complete filter 
translation functions are being supported (RFC 91).
 
Steve
 
From: mapserver-users-boun...@lists.osgeo.org [
mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of 
steve.tout...@inspq.qc.ca
Sent: Monday, January 26, 2015 8:55 AM
To: mapserver-users@lists.osgeo.org
Subject: [mapserver-users] Mapserver doesn't send good filter to postgis
 
Sorry my first post was with an inapprpriate title.. 

I'm using mapserver 6.4.1 and postgis 2.1 

using OpenLayers 2.13.1 I draw a small polygon that I use for a within 
spatial filter of a WFS getfeature request. The problem is that mapserver 
is not sending this polygon to postgis, it is sending the extent of the 
mapfile as filter... 

The wfs POST Request (created and send by OpenLayers client) 
ogc:Filter xmlns:ogc=http://www.opengis.net/ogc
ogc:Withinogc:PropertyNamemsGeometry/ogc:PropertyNamegml:Polygon 
xmlns:gml=http://www.opengis.net/gml; 
srsName=urn:ogc:def:crs:EPSG::3857gml:exteriorgml:LinearRinggml:posList-8081644.2511244
 
5835062.56996 -8081707.5505384 5834980.1612889 -8081638.2794815 
5834913.2788892 -8081533.1785677 5834988.5215889 -8081644.2511244 
5835062.56996/gml:posList/gml:LinearRing/gml:exterior/gml:Polygon/ogc:Within/ogc:Filter
 


In Mapserver log, I see 
FLTLayerApplyPlainFilterToLayer():  ([shape]  within  fromText('POLYGON 
((-8081644.2511243997141719 5835062.569959934435, 
-8081707.5505384001880884 5834980.1612889003008604, 
-8081638.2794815003871918 5834913.2788891997188330, 
-8081533.1785677000880241 5834988.5215889001265168, 
-8081644.2511243997141719 5835062.569959934435))')) 

Then a few lines later, I see that it is not sending the polygon received 
as filter 
select ...  where geom_p  ST_GeomFromText('POLYGON((-9239517 
5465442,-9239517 9349764,-5565974 9349764,-5565974 5465442,-9239517 
5465442))',3857); 

See the polygon definition is different, postgis receive the extent 
defined in the mapfile 
EXTENT -9239517 5465442 -5565974 9349764 


And, in postgis log I see this query, See the 
select ... where geom_p  ST_GeomFromText('POLYGON((-9239517 
5465442,-9239517 9349764,-5565974 9349764,-5565974 5465442,-9239517 
5465442))',3857); 


Why Mapserver is not sending the polygon received as filter to postgis? 


Thanks! 
Steve Toutant, M. Sc.
Analyste en géomatique
Secteur environnement
Direction de la santé environnementale et de la toxicologie
Institut national de santé publique du Québec
Tél.: 418 646-6777 poste 30015
Téléc.: 418 644-4593
steve.tout...@inspq.qc.ca
http://www.inspq.qc.ca
http://www.monclimatmasante.qc.ca 
Pour me rejoindre par courrier
Service de l'infrastructure et du réseau
Direction des technologies de l'information
Ministère de la Sécurité Publique
2525 boul. Laurier, 2e étage
Tour Laurentides
Québec, G1V 2L2 


___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] Mapserver doesn't send good filter to postgis

2015-01-26 Thread Steve . Toutant
sorry I'm confused, perhaps I misunderstand what you explained.  I don't 
understand what you mean by MapServer does use the supplied geometry, 
it?s a matter of where the filter is applied ? the database or in 
MapServer

In mapserver log I see 
FLTLayerApplyPlainFilterToLayer():  ([shape]  within  fromText('POLYGON 
((-8081644.2511243997141719 5835062.569959934435, 
-8081707.5505384001880884 5834980.1612889003008604, 
-8081638.2794815003871918 5834913.2788891997188330, 
-8081533.1785677000880241 5834988.5215889001265168, 
-8081644.2511243997141719 5835062.569959934435))')) 

So this is good, but
A few lines later in the mapserver log, I see that it is not sending the 
supplied geometry as filter, it is sending the extent of the mapfile
select ...  where geom_p  ST_GeomFromText('POLYGON((-9239517 
5465442,-9239517 9349764,-5565974 9349764,-5565974 5465442,-9239517 
5465442))',3857);

So it received the supplied geometry, but it is not using it

If only BBOX can be used as a spatial operator, it is not good for our 
needs. We really need to know what features are inside a user defined 
polygon.







Lime, Steve D (MNIT) steve.l...@state.mn.us 
2015-01-26 10:56

A
steve.tout...@inspq.qc.ca steve.tout...@inspq.qc.ca
cc
mapserver-users@lists.osgeo.org mapserver-users@lists.osgeo.org
Objet
RE: [mapserver-users] Mapserver doesn't send good filter to postgis








MapServer does use the supplied geometry, it?s a matter of where the 
filter is applied ? the database or in MapServer. This isn?t a new 
limitation so others may have more experience with workarounds. Maybe try 
also setting a bbox in the filter based on the bbox of the geometry? 
 
Steve
 
From: steve.tout...@inspq.qc.ca [mailto:steve.tout...@inspq.qc.ca] 
Sent: Monday, January 26, 2015 9:38 AM
To: Lime, Steve D (MNIT)
Cc: mapserver-users@lists.osgeo.org
Subject: RE: [mapserver-users] Mapserver doesn't send good filter to 
postgis
 
I understand the objective of rfc 91, but the most common use case would 
be to pass the supplied geometry. 
If mapserver doesn't use the supplied geometry, that means that it doesn't 
support spatial filtering. 
Our data covers the whole country, not using the supplied geometry means 
we can't use mapserver as a wfs server 
Is there something we can do about it? A workaround we could use? 



Lime, Steve D (MNIT) steve.l...@state.mn.us 
2015-01-26 10:14 


A
steve.tout...@inspq.qc.ca steve.tout...@inspq.qc.ca, 
mapserver-users@lists.osgeo.org mapserver-users@lists.osgeo.org 
cc

Objet
RE: [mapserver-users] Mapserver doesn't send good filter to postgis
 










It?s a limitation in older versions of MapServer where specific backend 
optimizations were scattered about the WMS/WFS code. Most of those 
optimizations address the most common use cases ? I guess this wasn?t one 
of them. It?s surprising that at worst the extent of the supplied geometry 
isn?t passed (I see a comment in the WFS code about this). The specific 
filter intersection test is applied on the MapServer side ? the results 
are correct, performance can suffer though. 
  
This is being addresses in MapServer 7.0 where more complete filter 
translation functions are being supported (RFC 91). 
  
Steve 
  
From: mapserver-users-boun...@lists.osgeo.org [
mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of 
steve.tout...@inspq.qc.ca
Sent: Monday, January 26, 2015 8:55 AM
To: mapserver-users@lists.osgeo.org
Subject: [mapserver-users] Mapserver doesn't send good filter to postgis 
  
Sorry my first post was with an inapprpriate title.. 

I'm using mapserver 6.4.1 and postgis 2.1 

using OpenLayers 2.13.1 I draw a small polygon that I use for a within 
spatial filter of a WFS getfeature request. The problem is that mapserver 
is not sending this polygon to postgis, it is sending the extent of the 
mapfile as filter... 

The wfs POST Request (created and send by OpenLayers client) 
ogc:Filter xmlns:ogc=http://www.opengis.net/ogc
ogc:Withinogc:PropertyNamemsGeometry/ogc:PropertyNamegml:Polygon 
xmlns:gml=http://www.opengis.net/gml; 
srsName=urn:ogc:def:crs:EPSG::3857gml:exteriorgml:LinearRinggml:posList-8081644.2511244
 
5835062.56996 -8081707.5505384 5834980.1612889 -8081638.2794815 
5834913.2788892 -8081533.1785677 5834988.5215889 -8081644.2511244 
5835062.56996/gml:posList/gml:LinearRing/gml:exterior/gml:Polygon/ogc:Within/ogc:Filter
 


In Mapserver log, I see 
FLTLayerApplyPlainFilterToLayer():  ([shape]  within  fromText('POLYGON 
((-8081644.2511243997141719 5835062.569959934435, 
-8081707.5505384001880884 5834980.1612889003008604, 
-8081638.2794815003871918 5834913.2788891997188330, 
-8081533.1785677000880241 5834988.5215889001265168, 
-8081644.2511243997141719 5835062.569959934435))')) 

Then a few lines later, I see that it is not sending the polygon received 
as filter 
select ...  where geom_p  ST_GeomFromText('POLYGON((-9239517 
5465442,-9239517 9349764,-5565974 9349764,-5565974 5465442,-9239517

Re: [mapserver-users] Mapserver doesn't send good filter to postgis

2015-01-26 Thread Lars Fricke

  
  
Hello Steve,
  
  maybe you can use a bounding box instead taking the
  
  
  
  bbox=793732,6570204,793765,6570228 command in the WFS
  request somehow (with your own coordinates naturally)? I do not
  work with open layers so I do not know how to do it there. It
  works quite nicely in Leaflet. 
  Basically I zoom to where I'm interested in and then fire the
  request. I guess one could also do this without zooming in first.
  
  Hope this can be of any help.
  
  Cheers
  
  Lars
  
  Am 26.01.2015 um 16:38 schrieb steve.tout...@inspq.qc.ca:


  I understand the objective of
  rfc 91,
  but the most common use case would be to pass the supplied
  geometry.
  
  If mapserver doesn't use the
  supplied
  geometry, that means that it doesn't support spatial
  filtering. 
  
  Our data covers the whole
  country, not
  using the supplied geometry means we can't use mapserver as a
  wfs server
  
  Is there something we can do
  about it?
  A workaround we could use?
  
  
  
  
  
  
  
  




  

  "Lime,
Steve D (MNIT)" steve.l...@state.mn.us 
2015-01-26 10:14

  
  

  

  
A
  
  "steve.tout...@inspq.qc.ca"
  steve.tout...@inspq.qc.ca,
  "mapserver-users@lists.osgeo.org"
  mapserver-users@lists.osgeo.org
  


  
cc
  
  

  


  
Objet
      
  RE:
          [mapserver-users] Mapserver doesn't send good
      filter to postgis

  



  

  

  
  
  

  


  

  






It’s a limitation
  in older
  versions of MapServer where specific backend optimizations
  were scattered
  about the WMS/WFS code. Most of those optimizations address
  the most common
  use cases – I guess this wasn’t one of them. It’s surprising
  that at
  worst the extent of the supplied geometry isn’t passed (I see
  a comment
  in the WFS code about this). The specific filter intersection
  test is applied
  on the MapServer side – the results are correct, performance
  can suffer
  though.

 

This is being
  addresses in
  MapServer 7.0 where more complete filter translation functions
  are being
  supported (RFC 91).

 

Steve

 

From:
  mapserver-users-boun...@lists.osgeo.org
  [mailto:mapserver-users-boun...@lists.osgeo.org]
  On Behalf Of steve.tout...@inspq.qc.ca
Sent: Monday, January 26, 2015 8:55 AM
To: mapserver-users@lists.osgeo.org
Subject: [mapserver-users] Mapserver doesn't send good
  filter to postgis

 

Sorry my first post was with an
  inapprpriate
  title.. 

  I'm using mapserver 6.4.1 and postgis 2.1
  

  using OpenLayers 2.13.1 I draw a small polygon that I use for
  a within
  spatial filter of a WFS getfeature request. The problem is
  that mapserver
  is not sending this polygon to postgis, it is sending the
  extent of the
  mapfile as filter... 

  The wfs POST Request (created and send by OpenLayers client)

  ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"ogc:Withinogc:PropertyNamemsGeometry/ogc:PropertyNamegml:Polygon
  xmlns:gml="http://www.opengis.net/gml"
  srsName="urn:ogc:def:crs:EPSG::3857"gml:exteriorgml:LinearRinggml:posList-8081644.2511244
5835062.56996
  -8081707.5505384 5834980.1612889 -8081638.2794815
  5834913.2788892

Re: [mapserver-users] Mapserver doesn't send good filter to postgis

2015-01-26 Thread Lime, Steve D (MNIT)
MapServer does use the supplied geometry, it's a matter of where the filter is 
applied - the database or in MapServer. This isn't a new limitation so others 
may have more experience with workarounds. Maybe try also setting a bbox in the 
filter based on the bbox of the geometry?

Steve

From: steve.tout...@inspq.qc.ca [mailto:steve.tout...@inspq.qc.ca]
Sent: Monday, January 26, 2015 9:38 AM
To: Lime, Steve D (MNIT)
Cc: mapserver-users@lists.osgeo.org
Subject: RE: [mapserver-users] Mapserver doesn't send good filter to postgis


I understand the objective of rfc 91, but the most common use case would be to 
pass the supplied geometry.

If mapserver doesn't use the supplied geometry, that means that it doesn't 
support spatial filtering.

Our data covers the whole country, not using the supplied geometry means we 
can't use mapserver as a wfs server

Is there something we can do about it? A workaround we could use?


Lime, Steve D (MNIT) steve.l...@state.mn.usmailto:steve.l...@state.mn.us

2015-01-26 10:14

A

steve.tout...@inspq.qc.camailto:steve.tout...@inspq.qc.ca 
steve.tout...@inspq.qc.camailto:steve.tout...@inspq.qc.ca, 
mapserver-users@lists.osgeo.orgmailto:mapserver-users@lists.osgeo.org 
mapserver-users@lists.osgeo.orgmailto:mapserver-users@lists.osgeo.org

cc

Objet

RE: [mapserver-users] Mapserver doesn't send good filter to postgis









It's a limitation in older versions of MapServer where specific backend 
optimizations were scattered about the WMS/WFS code. Most of those 
optimizations address the most common use cases - I guess this wasn't one of 
them. It's surprising that at worst the extent of the supplied geometry isn't 
passed (I see a comment in the WFS code about this). The specific filter 
intersection test is applied on the MapServer side - the results are correct, 
performance can suffer though.

This is being addresses in MapServer 7.0 where more complete filter translation 
functions are being supported (RFC 91).

Steve

From: 
mapserver-users-boun...@lists.osgeo.orgmailto:mapserver-users-boun...@lists.osgeo.org
 [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of 
steve.tout...@inspq.qc.camailto:steve.tout...@inspq.qc.ca
Sent: Monday, January 26, 2015 8:55 AM
To: mapserver-users@lists.osgeo.orgmailto:mapserver-users@lists.osgeo.org
Subject: [mapserver-users] Mapserver doesn't send good filter to postgis

Sorry my first post was with an inapprpriate title..

I'm using mapserver 6.4.1 and postgis 2.1

using OpenLayers 2.13.1 I draw a small polygon that I use for a within spatial 
filter of a WFS getfeature request. The problem is that mapserver is not 
sending this polygon to postgis, it is sending the extent of the mapfile as 
filter...

The wfs POST Request (created and send by OpenLayers client)
ogc:Filter 
xmlns:ogc=http://www.opengis.net/ogc;ogc:Withinogc:PropertyNamemsGeometry/ogc:PropertyNamegml:Polygon
 xmlns:gml=http://www.opengis.net/gml; 
srsName=urn:ogc:def:crs:EPSG::3857gml:exteriorgml:LinearRinggml:posList-8081644.2511244
 5835062.56996 -8081707.5505384 5834980.1612889 -8081638.2794815 
5834913.2788892 -8081533.1785677 5834988.5215889 -8081644.2511244 
5835062.56996/gml:posList/gml:LinearRing/gml:exterior/gml:Polygon/ogc:Within/ogc:Filter

In Mapserver log, I see
FLTLayerApplyPlainFilterToLayer():  ([shape]  within  fromText('POLYGON 
((-8081644.2511243997141719 5835062.569959934435, -8081707.5505384001880884 
5834980.1612889003008604, -8081638.2794815003871918 5834913.2788891997188330, 
-8081533.1785677000880241 5834988.5215889001265168, -8081644.2511243997141719 
5835062.569959934435))'))

Then a few lines later, I see that it is not sending the polygon received as 
filter
select ...  where geom_p  ST_GeomFromText('POLYGON((-9239517 
5465442,-9239517 9349764,-5565974 9349764,-5565974 5465442,-9239517 
5465442))',3857);

See the polygon definition is different, postgis receive the extent defined in 
the mapfile
EXTENT -9239517 5465442 -5565974 9349764


And, in postgis log I see this query, See the
select ... where geom_p  ST_GeomFromText('POLYGON((-9239517 
5465442,-9239517 9349764,-5565974 9349764,-5565974 5465442,-9239517 
5465442))',3857);


Why Mapserver is not sending the polygon received as filter to postgis?


Thanks!

Steve Toutant, M. Sc.
Analyste en géomatique
Secteur environnement
Direction de la santé environnementale et de la toxicologie
Institut national de santé publique du Québec
Tél.: 418 646-6777 poste 30015
Téléc.: 418 644-4593
steve.tout...@inspq.qc.camailto:steve.tout...@inspq.qc.ca
http://www.inspq.qc.cahttp://www.inspq.qc.ca/
http://www.monclimatmasante.qc.cahttp://www.monclimatmasante.qc.ca/

Pour me rejoindre par courrier
Service de l'infrastructure et du réseau
Direction des technologies de l'information
Ministère de la Sécurité Publique
2525 boul. Laurier, 2e étage
Tour Laurentides
Québec, G1V 2L2

___
mapserver-users mailing list
mapserver-users

Re: [mapserver-users] Mapserver doesn't send good filter to postgis

2015-01-26 Thread Lime, Steve D (MNIT)
It's a limitation in older versions of MapServer where specific backend 
optimizations were scattered about the WMS/WFS code. Most of those 
optimizations address the most common use cases - I guess this wasn't one of 
them. It's surprising that at worst the extent of the supplied geometry isn't 
passed (I see a comment in the WFS code about this). The specific filter 
intersection test is applied on the MapServer side - the results are correct, 
performance can suffer though.

This is being addresses in MapServer 7.0 where more complete filter translation 
functions are being supported (RFC 91).

Steve

From: mapserver-users-boun...@lists.osgeo.org 
[mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of 
steve.tout...@inspq.qc.ca
Sent: Monday, January 26, 2015 8:55 AM
To: mapserver-users@lists.osgeo.org
Subject: [mapserver-users] Mapserver doesn't send good filter to postgis

Sorry my first post was with an inapprpriate title..

I'm using mapserver 6.4.1 and postgis 2.1

using OpenLayers 2.13.1 I draw a small polygon that I use for a within spatial 
filter of a WFS getfeature request. The problem is that mapserver is not 
sending this polygon to postgis, it is sending the extent of the mapfile as 
filter...

The wfs POST Request (created and send by OpenLayers client)
ogc:Filter 
xmlns:ogc=http://www.opengis.net/ogc;ogc:Withinogc:PropertyNamemsGeometry/ogc:PropertyNamegml:Polygon
 xmlns:gml=http://www.opengis.net/gml; 
srsName=urn:ogc:def:crs:EPSG::3857gml:exteriorgml:LinearRinggml:posList-8081644.2511244
 5835062.56996 -8081707.5505384 5834980.1612889 -8081638.2794815 
5834913.2788892 -8081533.1785677 5834988.5215889 -8081644.2511244 
5835062.56996/gml:posList/gml:LinearRing/gml:exterior/gml:Polygon/ogc:Within/ogc:Filter

In Mapserver log, I see
FLTLayerApplyPlainFilterToLayer():  ([shape]  within  fromText('POLYGON 
((-8081644.2511243997141719 5835062.569959934435, -8081707.5505384001880884 
5834980.1612889003008604, -8081638.2794815003871918 5834913.2788891997188330, 
-8081533.1785677000880241 5834988.5215889001265168, -8081644.2511243997141719 
5835062.569959934435))'))

Then a few lines later, I see that it is not sending the polygon received as 
filter
select ...  where geom_p  ST_GeomFromText('POLYGON((-9239517 
5465442,-9239517 9349764,-5565974 9349764,-5565974 5465442,-9239517 
5465442))',3857);

See the polygon definition is different, postgis receive the extent defined in 
the mapfile
EXTENT -9239517 5465442 -5565974 9349764


And, in postgis log I see this query, See the
select ... where geom_p  ST_GeomFromText('POLYGON((-9239517 
5465442,-9239517 9349764,-5565974 9349764,-5565974 5465442,-9239517 
5465442))',3857);


Why Mapserver is not sending the polygon received as filter to postgis?


Thanks!

Steve Toutant, M. Sc.
Analyste en géomatique
Secteur environnement
Direction de la santé environnementale et de la toxicologie
Institut national de santé publique du Québec
Tél.: 418 646-6777 poste 30015
Téléc.: 418 644-4593
steve.tout...@inspq.qc.camailto:steve.tout...@inspq.qc.ca
http://www.inspq.qc.cahttp://www.inspq.qc.ca/
http://www.monclimatmasante.qc.cahttp://www.monclimatmasante.qc.ca/

Pour me rejoindre par courrier
Service de l'infrastructure et du réseau
Direction des technologies de l'information
Ministère de la Sécurité Publique
2525 boul. Laurier, 2e étage
Tour Laurentides
Québec, G1V 2L2
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] Mapserver doesn't send good filter to postgis

2015-01-26 Thread Stephen Woodbridge

Steve T.,

mapserver gets back all the geometries from postgis and then filters 
them in mapserver against the geometry.


Mapserver passes the BBOX for the mapfile to postgis as you noticed 
which is not very efficient, but you can override that to the BBOX of 
the window using the BBOX substitution variable in the SQL, but this 
might not be what you want if you geometry is off screen.


I'm not aware of any way to pass the BBOX of the geometry.

Steve L - can we do this?

So currently, your wfs requests are getting filtered against the 
geometry. And there is room for efficiency improvements.


-Steve W

On 1/26/2015 11:15 AM, steve.tout...@inspq.qc.ca wrote:

sorry I'm confused, perhaps I misunderstand what you explained.  I don't
understand what you mean by MapServer does use the supplied geometry,
it’s a matter of where the filter is applied – the database or in
MapServer

In mapserver log I see

FLTLayerApplyPlainFilterToLayer():  ([shape]  within  fromText('POLYGON
((-8081644.2511243997141719 5835062.569959934435,
-8081707.5505384001880884 5834980.1612889003008604,
-8081638.2794815003871918 5834913.2788891997188330,
-8081533.1785677000880241 5834988.5215889001265168,
-8081644.2511243997141719 5835062.569959934435))'))

So this is good, but
A few lines later in the mapserver log, I see that it is not sending the
supplied geometry as filter, it is sending the extent of the mapfile
select ...  where geom_p  ST_GeomFromText('POLYGON((-9239517
5465442,-9239517 9349764,-5565974 9349764,-5565974 5465442,-9239517
5465442))',3857);

So it received the supplied geometry, but it is not using it

If only BBOX can be used as a spatial operator, it is not good for our
needs. We really need to know what features are inside a user defined
polygon.




*Lime, Steve D (MNIT) steve.l...@state.mn.us*

2015-01-26 10:56


A
steve.tout...@inspq.qc.ca steve.tout...@inspq.qc.ca
cc
mapserver-users@lists.osgeo.org mapserver-users@lists.osgeo.org
Objet
RE: [mapserver-users] Mapserver doesn't send good filter to postgis










MapServer does use the supplied geometry, it’s a matter of where the
filter is applied – the database or in MapServer. This isn’t a new
limitation so others may have more experience with workarounds. Maybe
try also setting a bbox in the filter based on the bbox of the geometry?

Steve

*From:* steve.tout...@inspq.qc.ca [mailto:steve.tout...@inspq.qc.ca] *
Sent:* Monday, January 26, 2015 9:38 AM*
To:* Lime, Steve D (MNIT)*
Cc:* mapserver-users@lists.osgeo.org*
Subject:* RE: [mapserver-users] Mapserver doesn't send good filter to
postgis

I understand the objective of rfc 91, but the most common use case would
be to pass the supplied geometry.

If mapserver doesn't use the supplied geometry, that means that it
doesn't support spatial filtering.

Our data covers the whole country, not using the supplied geometry means
we can't use mapserver as a wfs server

Is there something we can do about it? A workaround we could use?


*Lime, Steve D (MNIT) **_steve.l...@state.mn.us_*
mailto:steve.l...@state.mn.us**

2015-01-26 10:14


A
_steve.tout...@inspq.qc.ca_ mailto:steve.tout...@inspq.qc.ca
_steve.tout...@inspq.qc.ca_ mailto:steve.tout...@inspq.qc.ca,
_mapserver-users@lists.osgeo.org_
mailto:mapserver-users@lists.osgeo.org
_mapserver-users@lists.osgeo.org_
mailto:mapserver-users@lists.osgeo.org
cc

Objet
RE: [mapserver-users] Mapserver doesn't send good filter to postgis











It’s a limitation in older versions of MapServer where specific backend
optimizations were scattered about the WMS/WFS code. Most of those
optimizations address the most common use cases – I guess this wasn’t
one of them. It’s surprising that at worst the extent of the supplied
geometry isn’t passed (I see a comment in the WFS code about this). The
specific filter intersection test is applied on the MapServer side – the
results are correct, performance can suffer though.

This is being addresses in MapServer 7.0 where more complete filter
translation functions are being supported (RFC 91).

Steve
*
From:* _mapserver-users-bounces@lists.osgeo.org_
mailto:mapserver-users-boun...@lists.osgeo.org
[_mailto:mapserver-users-bounces@lists.osgeo.org_] *On Behalf Of
*_steve.tout...@inspq.qc.ca_ mailto:steve.tout...@inspq.qc.ca*
Sent:* Monday, January 26, 2015 8:55 AM*
To:* _mapserver-users@lists.osgeo.org_
mailto:mapserver-users@lists.osgeo.org*
Subject:* [mapserver-users] Mapserver doesn't send good filter to postgis

Sorry my first post was with an inapprpriate title..

I'm using mapserver 6.4.1 and postgis 2.1

using OpenLayers 2.13.1 I draw a small polygon that I use for a within
spatial filter of a WFS getfeature request. The problem is that
mapserver is not sending this polygon to postgis, it is sending the
extent of the mapfile as filter...

The wfs POST Request (created and send by OpenLayers client)
ogc:Filter
xmlns:ogc

Re: [mapserver-users] Mapserver doesn't send good filter to postgis

2015-01-26 Thread Steve . Toutant
Thanks for your explanation Stephen.
I'm sure there were good reasons to do that, but it is a weird way of 
filtering.

I Cannot use the bbox of the window but as you suggest, passing the bbox 
of the geometry could be a workaround.
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.
Is this issue will really be improved in mapserver 7 for postgis and 
oracle? When is it scheduled?
thanks again for your help!
steve




Stephen Woodbridge wood...@swoodbridge.com@lists.osgeo.org 
Envoyé par : mapserver-users-boun...@lists.osgeo.org
2015-01-26 11:31

A
mapserver-users@lists.osgeo.org
cc

Objet
Re: [mapserver-users] Mapserver doesn't send good filter to postgis








Steve T.,

mapserver gets back all the geometries from postgis and then filters 
them in mapserver against the geometry.

Mapserver passes the BBOX for the mapfile to postgis as you noticed 
which is not very efficient, but you can override that to the BBOX of 
the window using the BBOX substitution variable in the SQL, but this 
might not be what you want if you geometry is off screen.

I'm not aware of any way to pass the BBOX of the geometry.

Steve L - can we do this?

So currently, your wfs requests are getting filtered against the 
geometry. And there is room for efficiency improvements.

-Steve W

On 1/26/2015 11:15 AM, steve.tout...@inspq.qc.ca wrote:
 sorry I'm confused, perhaps I misunderstand what you explained.  I don't
 understand what you mean by MapServer does use the supplied geometry,
 it?s a matter of where the filter is applied ? the database or in
 MapServer

 In mapserver log I see

 FLTLayerApplyPlainFilterToLayer():  ([shape]  within  fromText('POLYGON
 ((-8081644.2511243997141719 5835062.569959934435,
 -8081707.5505384001880884 5834980.1612889003008604,
 -8081638.2794815003871918 5834913.2788891997188330,
 -8081533.1785677000880241 5834988.5215889001265168,
 -8081644.2511243997141719 5835062.569959934435))'))

 So this is good, but
 A few lines later in the mapserver log, I see that it is not sending the
 supplied geometry as filter, it is sending the extent of the mapfile
 select ...  where geom_p  ST_GeomFromText('POLYGON((-9239517
 5465442,-9239517 9349764,-5565974 9349764,-5565974 5465442,-9239517
 5465442))',3857);

 So it received the supplied geometry, but it is not using it

 If only BBOX can be used as a spatial operator, it is not good for our
 needs. We really need to know what features are inside a user defined
 polygon.




 *Lime, Steve D (MNIT) steve.l...@state.mn.us*

 2015-01-26 10:56

 
 A
steve.tout...@inspq.qc.ca steve.tout...@inspq.qc.ca
 cc
mapserver-users@lists.osgeo.org 
mapserver-users@lists.osgeo.org
 Objet
RE: [mapserver-users] Mapserver doesn't send good filter 
to postgis


 







 MapServer does use the supplied geometry, it?s a matter of where the
 filter is applied ? the database or in MapServer. This isn?t a new
 limitation so others may have more experience with workarounds. Maybe
 try also setting a bbox in the filter based on the bbox of the geometry?

 Steve

 *From:* steve.tout...@inspq.qc.ca [mailto:steve.tout...@inspq.qc.ca] *
 Sent:* Monday, January 26, 2015 9:38 AM*
 To:* Lime, Steve D (MNIT)*
 Cc:* mapserver-users@lists.osgeo.org*
 Subject:* RE: [mapserver-users] Mapserver doesn't send good filter to
 postgis

 I understand the objective of rfc 91, but the most common use case would
 be to pass the supplied geometry.

 If mapserver doesn't use the supplied geometry, that means that it
 doesn't support spatial filtering.

 Our data covers the whole country, not using the supplied geometry means
 we can't use mapserver as a wfs server

 Is there something we can do about it? A workaround we could use?


 *Lime, Steve D (MNIT) **_steve.l...@state.mn.us_*
 mailto:steve.l...@state.mn.us**

 2015-01-26 10:14

 
 A
_steve.tout...@inspq.qc.ca_ 
mailto:steve.tout...@inspq.qc.ca
 _steve.tout...@inspq.qc.ca_ mailto:steve.tout...@inspq.qc.ca,
 _mapserver-users@lists.osgeo.org_
 mailto:mapserver-users@lists.osgeo.org
 _mapserver-users@lists.osgeo.org_
 mailto:mapserver-users@lists.osgeo.org
 cc
 
 Objet
RE: [mapserver-users] Mapserver doesn't send good filter 
to postgis



 







 It?s a limitation in older versions of MapServer where specific backend
 optimizations were scattered about the WMS/WFS code. Most of those
 optimizations address the most common use cases ? I guess this wasn?t
 one of them. It?s surprising that at worst the extent of the supplied
 geometry isn?t passed (I see a comment in the WFS code about this). The
 specific filter intersection test is applied on the MapServer side ? the
 results are correct, performance can suffer though.

 This is being addresses in MapServer 7.0 where more complete filter
 translation functions are being supported (RFC 91).

 Steve
 *
 From:* _mapserver

Re: [mapserver-users] Mapserver doesn't send good filter to postgis

2015-01-26 Thread Stephen Woodbridge

On 1/26/2015 2:12 PM, steve.tout...@inspq.qc.ca wrote:

Thanks for your explanation Stephen.
I'm sure there were good reasons to do that, but it is a weird way of
filtering.


It is a legacy issue the RFC 91 I think is trying to clean up. Mapserver 
started with rasters and shapefiles, so everything had to be done in 
mapserver. As it grew to support more data sources things have changes 
and we are trying to push this kind of filtering back into the data 
sources where it can be done efficiently, while still allow other data 
sources that do not support the native filtering to work also work by 
having a generic filing ability still built into mapserver.


Steve W


I Cannot use the bbox of the window but as you suggest, passing the bbox
of the geometry could be a workaround.

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.

Is this issue will really be improved in mapserver 7 for postgis and
oracle? When is it scheduled?

thanks again for your help!

steve




*Stephen Woodbridge wood...@swoodbridge.com@lists.osgeo.org*
Envoyé par : mapserver-users-boun...@lists.osgeo.org

2015-01-26 11:31


A
mapserver-users@lists.osgeo.org
cc

Objet
Re: [mapserver-users] Mapserver doesn't send good filter to postgis










Steve T.,

mapserver gets back all the geometries from postgis and then filters
them in mapserver against the geometry.

Mapserver passes the BBOX for the mapfile to postgis as you noticed
which is not very efficient, but you can override that to the BBOX of
the window using the BBOX substitution variable in the SQL, but this
might not be what you want if you geometry is off screen.

I'm not aware of any way to pass the BBOX of the geometry.

Steve L - can we do this?

So currently, your wfs requests are getting filtered against the
geometry. And there is room for efficiency improvements.

-Steve W

On 1/26/2015 11:15 AM, steve.tout...@inspq.qc.ca wrote:
  sorry I'm confused, perhaps I misunderstand what you explained.  I don't
  understand what you mean by MapServer does use the supplied geometry,
  it’s a matter of where the filter is applied – the database or in
  MapServer
 
  In mapserver log I see
 
  FLTLayerApplyPlainFilterToLayer():  ([shape]  within  fromText('POLYGON
  ((-8081644.2511243997141719 5835062.569959934435,
  -8081707.5505384001880884 5834980.1612889003008604,
  -8081638.2794815003871918 5834913.2788891997188330,
  -8081533.1785677000880241 5834988.5215889001265168,
  -8081644.2511243997141719 5835062.569959934435))'))
 
  So this is good, but
  A few lines later in the mapserver log, I see that it is not sending the
  supplied geometry as filter, it is sending the extent of the mapfile
  select ...  where geom_p  ST_GeomFromText('POLYGON((-9239517
  5465442,-9239517 9349764,-5565974 9349764,-5565974 5465442,-9239517
  5465442))',3857);
 
  So it received the supplied geometry, but it is not using it
 
  If only BBOX can be used as a spatial operator, it is not good for our
  needs. We really need to know what features are inside a user defined
  polygon.
 
 
 
 
  *Lime, Steve D (MNIT) steve.l...@state.mn.us*
 
  2015-01-26 10:56
 
 
  A
   steve.tout...@inspq.qc.ca steve.tout...@inspq.qc.ca
  cc
   mapserver-users@lists.osgeo.org
mapserver-users@lists.osgeo.org
  Objet
   RE: [mapserver-users] Mapserver doesn't send good
filter to postgis
 
 
 
 
 
 
 
 
 
 
  MapServer does use the supplied geometry, it’s a matter of where the
  filter is applied – the database or in MapServer. This isn’t a new
  limitation so others may have more experience with workarounds. Maybe
  try also setting a bbox in the filter based on the bbox of the geometry?
 
  Steve
 
  *From:* steve.tout...@inspq.qc.ca [mailto:steve.tout...@inspq.qc.ca] *
  Sent:* Monday, January 26, 2015 9:38 AM*
  To:* Lime, Steve D (MNIT)*
  Cc:* mapserver-users@lists.osgeo.org*
  Subject:* RE: [mapserver-users] Mapserver doesn't send good filter to
  postgis
 
  I understand the objective of rfc 91, but the most common use case would
  be to pass the supplied geometry.
 
  If mapserver doesn't use the supplied geometry, that means that it
  doesn't support spatial filtering.
 
  Our data covers the whole country, not using the supplied geometry means
  we can't use mapserver as a wfs server
 
  Is there something we can do about it? A workaround we could use?
 
 
  *Lime, Steve D (MNIT) **_steve.l...@state.mn.us_*
  mailto:steve.l...@state.mn.us**
 
  2015-01-26 10:14
 
 
  A
   _steve.tout...@inspq.qc.ca_
mailto:steve.tout...@inspq.qc.ca
  _steve.tout...@inspq.qc.ca_ mailto:steve.tout...@inspq.qc.ca,
  _mapserver-users@lists.osgeo.org_
  mailto:mapserver-users@lists.osgeo.org
  _mapserver-users@lists.osgeo.org_
  mailto:mapserver-users@lists.osgeo.org
  cc
 
  Objet
   RE: [mapserver-users