[mapserver-users] Issue in using MapServer WFS Filter

Kajod Sharma kajod4u at yahoo.com
Wed Apr 26 07:32:03 PDT 2017


Hi Steve,
Thanks for your response.

I have already tried with supplying SRS name in query. Now tried again, but results are still same.
Do you/someone know if I can somehow remove default spatial filter applied while MapServer makes a call to PostGIS?

Thanks. Regards,
Kajod


      From: Steve Toutant <Steve.Toutant at inspq.qc.ca>
 To: Kajod Sharma <kajod4u at yahoo.com> 
Cc: "mapserver-users at lists.osgeo.org" <mapserver-users at lists.osgeo.org>
 Sent: Wednesday, 26 April 2017 3:05 PM
 Subject: RE: [mapserver-users] Issue in using MapServer WFS Filter
   
Try adding &srsName="EPSG:4326"as a parameter
typeName=SampleLayer&srsName=EPSG:4326



De :       Kajod Sharma <kajod4u at yahoo.com>
A :       "mapserver-users at lists.osgeo.org"<mapserver-users at lists.osgeo.org>
Date :       2017-04-26 09:43
Objet :       [mapserver-users]Issue in using MapServer WFS Filter
Envoyé par :       "mapserver-users"<mapserver-users-bounces at lists.osgeo.org>



Hi,

Greetings!

I hope this is a right platform to discussmy query regarding FILTER applied on MapServer WFS.

I'm new in this area and exploring some featuresof MapServer. I want to use GetFeature request of WFS to get features appliedon any location on map. I'm using "MapServer version 7.0.4 (MS4W 3.2.1)"and trying to apply filter "Contains" for it.

I can see two problems when it applies Filterquery on PostGIS:

1. It looks it adds an extradefault geospatial filter in it while making a query to PostGIS. This defaultspatial filter is not stopping to return any result from PostGIS. Is thereany way to exclude this default filter?
2. It seems Contains coordinatesare not transformed properly according to SRS of data in PostGIS.

I've tries with different projection in mapfile and request message with no success.

Supporting data to give your input on myqueries:

WFS request
*************************
Formatted Version:

http://localhost/cgi-bin/mapserv.exe?
service=WFS&
map=C:/Data/MapServerWFSSample.map&
request=GetFeature&
version=2.0.0&
typeName=SampleLayer&
FILTER=<Filter xmlns="http://www.opengis.net/ogc"xmlns:gml="http://www.opengis.net/gml"xmlns:ms="http://mapserver.gis.umn.edu/mapserver">
  <Contains>
    <PropertyName>wkb_Geometry</PropertyName>
    <gml:Point srsName="urn:ogc:def:crs:EPSG::4326">
      <gml:coordinates>0.112034,53.567972</gml:coordinates>
    </gml:Point>
  </Contains>
</Filter>
*************************

PostGIS query [Could see in log file]:
*************************
msPostGISLayerWhichShapes query: select "Attribute1","Attribute2","Attribute3",encode(ST_AsBinary(ST_Force2D("wkb_geometry"),'NDR'),'hex')as geom from SampleGeoDataTable where wkb_geometry&& ST_GeomFromText('POLYGON((-0.999462804873474 -1.00102606014116,-0.999462804873474-1.00102606014116,-0.999462804873474 -1.00102606014116,-0.999462804873474-1.00102606014116,-0.999462804873474 -1.00102606014116))',find_srid('','SampleGeoDataTable','wkb_geometry'))and (st_contains(wkb_geometry,ST_GeomFromText('POINT (7853690.3631838141000000-5506204.5232773330000000)'))= TRUE)
*************************

Similar WFS query to GeoServer works perfectly.

It would be very helpful if someone can helpme on it. Thanks a lot in advance. 

Map File looks like:

**************************************************
MAP
  NAME "Sample_WMS"
  CONFIG "PROJ_LIB" "C:\ms4w\proj\nad"
  CONFIG "MS_ERRORFILE" "C:/Data/ms_tmp/ms_error.txt"
  CONFIG "CPL_DEBUG" "ON"
  CONFIG "PROJ_DEBUG" "ON"
  STATUS ON
  PROJECTION
    "init=epsg:27700"
  END  
  
  WEB
   IMAGEPATH "C:/Data/ms_tmp/"
   IMAGEURL "/ms_tmp/"
   METADATA  
    "wfs_enable_request" "*"
    "wfs_title"         "MyGlobal Map WFS Server"
    "wfs_srs"           "EPSG:4326EPSG:900913 EPSG:27700"
    "wfs_boundingbox"    "EPSG:27700749.099975585938 -90036.5 660460.875 1227306.5"     
   END
  END
  
  LAYER
   NAME "SampleLayer"
   STATUS DEFAULT
   TYPE POLYGON
   PROJECTION
    "init=epsg:27700"
   END   
   CONNECTIONTYPE POSTGIS
   CONNECTION "host=localhost port=5432 dbname=SampleGeoDataTableuser=postgres password=hahaha"
   DATA "wkb_geometry from SampleLayer"
   CLASS
     STYLE
      COLOR      0 100 255
      OUTLINECOLOR 0 0 0
     END 
   END
  
   METADATA      
    "wfs_enable_request" "*"
    "wfs_title"         "SampleWFS"
    "wfs_srs"           "EPSG:27700EPSG:4326 EPSG:900913"
    "wfs_boundingbox"    "EPSG:27700749.099975585938 -90036.5 660460.875 1227306.5"
    "gml_include_items" "all"
   END  
  END    
END
**************************************************

Regards,
Kajod_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20170426/d9972e38/attachment.html>


More information about the mapserver-users mailing list